A small and unkempt apartment building yesterday became the District's first public housing project in Adams-Morgan, a Northwest community that poor tenants have been driven out of in recent years as their rented homes and apartments were renovated and sold with six-figure price tags.

City housing director Robert L. Moore successfully outbid another buyer and bought the 15-unit, three-story tan brick building at 2422 Ontario Rd. for $172,000 during an afternoon foreclosure auction. The city will probably have to spend $250,000 more to repair the building, officials said.

Della Woodley and Yvonne Wheeler, leaders of the tenant association, broke into tears of happiness, and hugged each other after Moore outbid Ralph D. Kaiser, the holder of the first mortgage, for the building.

For the last year, the tenants have been living in the building that the previous owner started gutting but then ran out of money, leaving residents to live among a welter of exposed wires, ripped-out kitchen, bathroom and hallway walls, and a general mess of construction debris, the women said.

The tenants went on a rent strike last December after the work was not completed, said Woodley, who lives in a basement apartment with her two granddaughters and a great-grandchild. A few weeks after the strike began, they received notices to move so the building could be closed, she said.

"We've been living through hell," said Woodley, who along with Wheeler had urged the city to buy the building so that "we would have some place to live and not have to worry about being thrown out."

The city spent almost $30,000 to replace walls and buy heating oil.

Woodley, Wheeler and the five other tenants currently in the building will remain because their incomes qualify them for public housing, Moore said.

The tenants, who pay between $118 and $138 a month in rent, will probably pay less under city management, Moore said, because public housing tenants must pay only 25 percent of their income for rent.

The acquisition is the latest in the city's ambitious program to scatter 2,000 new public housing units -- single-family homes, cooperatives and small apartment buildings -- throughout the city.

Adams-Morgan, which has become a fashionable address for middle-class whites and blacks, is in Ward 1. Six other public housing developments are located in the ward but half of these are concentrated in the eastern part and at the foot of Howard University along Fourth Street.

D.C. city council member David A. Clarke, who represents the ward, said the community probably would not oppose the purchase, which he supports.

Adams-Morgan, which has the city's largest concentration of Spanish-speaking families, has long been known for its economically and racially diverse population, and the tolerance residents display to one another.

The tenants' nightmare began last June shortly after William Ellis, an economist who now works for an African government, bought the building for $185,000 and told the tenants he needed to make "some minor repairs."

"He just destroyed the place," said Wheeler, who has lived there for four years.

Ellis's attorney, Ray Engebretsen, denied an allegation by Wheeler that Ellis's intention was to get residents to leave the building, and blamed the upheaval caused by workmen on his client's inexperience in real estate.

For a while, Wheeler said, he could look from her kitchen into the living room of the next apartment because the wall was gone. The tenant living below her could look into her bathroom because part of the floor was removed by workmen, she said.

"The tenants had no privacy," said Moore.

Woodley said she remained in the building despite the mess because, "after he [Ellis] came in here with a nice face and told us he was going to make repairs and then gutted it, I said since you left us in this hole, we are going to fight you."