The city of Chicago was told yesterday it must see that more subsidized housing is built or risk losing millions of dollars in federal funds a year from now.

The action by the Department of Housing and Urban Development was aimed at opening opportunities for poor people - many of them black - to move out of the ghettos of a city that is one of the most segregated in the country in its housing patterns.

HUD wrote Mayor Michael A. Bilandic urging him to take actions that could result in the construction of 2,000 to 3,000 units low- and moderate-income people in the next few years.

It could also force him to see that most of those units are built in white areas of the city.

Chicago's housing authority is under a court order to build subsidized housing in white as well as black areas, but very little construction of such housing has occurred in any area, white or black.

As a result, HUD has been under increasing pressure to prod the city and the Chicago Housing Authority, which is responsible for subsidized housing, to find sites and developers for the units.

Alexander Polikoff, attorney for the plaintiffs in the court case, said he was disappointed by HUD's letter because it does not specify the number of units that must be built, the areas where they should go, or the time period required for building them.

Polikoff said he would urge the U.S. District Court in Chicago today to require HUD to impose "more stringent standards."

HUD spokesman Bill M. Wise argued that "the language of the letter is quite strong and quite specific. The city has been told it must take certain actions or funding may be cut next year."

Noting the political minefield that HUD is crossing, Assistant Secretary Robert C. Embry Jr. commented, "A lot of people in Congress think we're too heavy-handed in getting into a city's affairs. But we think this is what the law requires.

"There are two equities: Poor people need housing and some cities have a great deal of racial tension and are losing their middle class. The problem is how to provide housing without exacerbating racial tensions."

This year localities are receiving about $3.5 billion in community development block grants. Under the 1974 law setting up the grant program, they must submit housing assistance plans to HUD telling what they plan to do to meet the housing needs of low- and moderate-income people residing or expected to reside in their jurisdictions.

Chicago's plan indicates that it should provide about 5,000 more new units of family housing for lower-income people by September 1979. Under the court order - which applies to HUD as well as the Chicago Housing Authority - about 3,000 of those units should be built in white areas.

The HUD letter said, "The city shall take all necessary actions within its control and in a timely fashion to bring about the actual construction" of housing units for large and small families aided by a HUD rent-subsidy program set up under Section 8 of the 1974 act.

Chicago should promote that construction using "the resources to be allocated to the city" during the next fiscal year, the letter said. A HUD source said last night that the exact amount had not been determined but should be enough to permit construction of 2,000 to 3,000 units.

HUD also ordered the city to use community development grants "as necessary to facilitate such construction." "That means using the funds to buy sites, improve sites, help pay for architectural and engineering costs, and, possibly, to create its own city development corporation," Embry said.

The letter stressed that the city "must make substantially improved progress" in meeting its own goals for building apartments for large families and for major rehabilitation of existing rental units for such families.

"Failure to accomplish these actions may constitute cause for the secretary of housing and urban development to reduce the community development block grant of the city of Chicago" for next year, the letter said.

Polikoff said that HUD had imposed more specific conditions on the community development money it gives Philadelphia, Pittsburgh, Boston and Toledo, Ohio.