Cedar Square West in Minneapolis, the largest public housing development acquired by the Department of Housing and Urban Development through foreclosure, is not going the way of many such projects, thanks to a lawsuit and more than a year of negotiations.

Under an accord reached last week with the Reagan administration, the Minneapolis city government agreed to pay $15 million for the property, which includes 1,303 apartments, and said it intends to preserve the 669 low-income apartments there.

Such agreements between federal and city housing authorities are rare because local governments usually cannot match prices offered by private buyers when HUD sells foreclosed properties.

As a result, hundreds of low-income housing units have been lost in U.S. cities because of sales agreements that required continuation of subsidies for short terms or not at all.

Federal Housing Commissioner Thomas T. Demery said Minneapolis officials' concern that Cedar Square West would be sold without adequate measures to preserve low-income units was "unfounded." The department intended to provide subsidies for 600 units as part of the sale, he said.

HUD foreclosed in 1986 on Cedar Square West whose owners had defaulted on their mortgage several years earlier. The department announced plans to sell the property through competitive bidding but without making nearly $8 million in repairs that city housing authorities said are needed.

Fearing that low-income residents would be displaced by rent increases or changes in subsidies, the city sued to block the bidding and force repairs. The complex is in an established, middle-class neighborhood near the University of Minnesota campus.

Under the agreement, Minneapolis housing authorities will sell the property to a consortium of private owners, including a tenants' organization, on terms requiring the buyers to make $7.9 million worth of repairs, officials said.

During the last decade, HUD often has sold foreclosed apartment buildings and projects to the highest bidders, frequently without restrictions or subsidies that would effectively preserve units for low-income tenants, according to critics.

Legislation in 1978 and 1981 established requirements intended to preserve such units, but the administration often has sold properties on terms skirting legal limits, according to housing advocates.

The housing authorization bill signed last Friday by President Reagan would make it easier for other cities and states to acquire federally owned property without the lawsuits and protracted negotiations that marked the sale of Cedar Square West.

The law gives local governments right of first refusal when foreclosed properties are sold, although they must match the high bid accepted by HUD. It also imposes additional low-income use restrictions on properties.

The agreement was announced here by Sen. David F. Durenberger (R-Minn.), who cited "the virtual halt in the building of new low- and moderate-income housing during the past . . . . "

In foreclosing, HUD paid a $39 million insurance claim, but a department official said he did not know the total of holding and operating costs incurred after the foreclosure.

The city plans to sell Cedar Square West to a consortium of three private developers, a nonprofit developer and the tenants' group.

The purchasers must agree to make $7.9 million worth of repairs and ensure that the low-income units remain affordable for poor tenants after current federal rental subsidies expire in 15 years, said Ned Foster, the Minneapolis Community Development Agency's coordinator for Cedar Square West.

The city will retain ownership of the land while selling the buildings and other improvements to the consortium, he said.

A requirement to maintain long-term affordability of low-income units if federal subsidies are not renewed when they expire also is part of the agreement with the consortium.

HUD's plan for selling the property would have provided subsidies for 600 low-income units but no provision for renewing rental assistance after the initial subsidies expired, according to Sarah Johnson of Telesis Corp., a consulting firm here that helped the city negotiate the pact.

City officials said they plan to raise financing through sale of housing revenue bonds and use of low-income tax credits to attract private investors.

Cedar Square West was a troubled project from the time construction ended in 1973, according to Foster. Its buildings were the first phase of what was to be a "whole new community" of market-rate and low-income housing that would be 10 times larger than the current complex, he said.

A community group, the Cedar Riverside Project Area Committee, successfully sued to prevent completion of the development, saying that the project "called for the demolition of the entire neighborhood" and that "we felt the density and type of high-rise housing was inappropriate" for families with children, said Tim Mungavan, a consultant to the organization.

The committee was first to sue the HUD last year to block sale to a private owner. Then came the city and the Riverside Plaza Tenants Association, a Cedar Square West tenants' group, Mungavan said.

Original design flaws and structural problems made Cedar Square West a development that "never worked," Foster said. For example, one building, a 39-story tower, has only three low-speed elevators, making the wait for an elevator as long as half an hour, he said.

Repairs demanded by the city "were not necessary and not health- and safety-related," said R. Hunter Cushing, HUD's deputy assistant secretary for multifamily housing. The proposed repairs "were things to improve the quality of life . . . but they exceeded our normal conditions for sale."

The department was willing to negotiate a sale with the city "but we were looking to receive what the property was worth," said James E. Schoenberger, deputy assistant secretary for housing. "We are looking to protect the financial interests of the government, so we expect to be paid the market value."

HUD sells about 100 foreclosed multifamily properties a year, nearly all through competitive bidding, Demery said. The department holds 62 foreclosed developments containing about 11,000 units and has taken over 1,400 mortgages on which owners have defaulted, he said.

The department has authority to negotiate sales with local and state governments but rarely does so because local governments and nonprofit groups usually do not have the money to buy, Schoenberger said.