Mayor Marion Barry said yesterday the District of Columbia is approaching agreement with federal officials on subsidies needed to repair many of the city's thousands of decayed public housing units.

Barry made the comment after meeting for nearly 1 1/2 hours with a group of high-ranking officials of the U.S. Department of Housing and Urban Development, headed by Lawrence B. Simons, assistant secretary for housing.

The mayor said D.C. and HUD officials are close to agreement on cost figures that could lead to the city collecting several million dollars in retroactive federal subsidies for operating the city's projects.

"For the first time, our figures and theirs are about the same," Barry told a reporter after returning to the District Building.

A press spokesman for HUD said Simons would have no comment on yesterday's meeting.

Barry also said city and federal officials are moving toward an agreement on how much it might cost to repair 3,086 city-operated apartments comprising what the District's housing director has called the 10 worst public housing projects in the city.

City Housing Director Robert L. Moore recently estimated that it could cost as much as $60 million to repair the projects. Moore said the worst projects lack hot water and heat in the winter, as well as working stoves, refrigerators, toilets and bathtubs.

All operating expenses for the projects come from rent payments, which amount to $9 million annually, and a federal subsidy that Barry said has has remained at or below $16 million a year for several years.

"There is no way the city could run the projects when the subsidy stayed the same and the costs kept going up," Barry said. He said he found the public housing agency's books and conditions in "a mess" when he took office last January.

For one thing, the city's housing agency started delaying needed maintenance in 1974, the first year it overspent its operating budget and began running afoul of HUD-established federal regulations.

Barry said the retroactive increase in subsidy would be made to reimburse the city for higher costs of such public utility services as water and electricity, which he said were not reflected in HUD's original payments.

The mayor also said he expects to work out increased subsidies for the current 1979 fiscal year and the 1980 fiscal year, which begins Oct. 1.

"It was a good meeting. We're going to keep working at it," Barry said. He added that it's possible a joint task force of officials from HUD's national and Washington Metropolitan offices and city officials may be formed to chart a future course.

Barry is expected to announce the creation of a similar task force today to work out problems in the city's troubled Labor Department.

The mayor, who had met previously with Simons, said he asked for yesterday's meeting, and that he expects to hold another such session in about a month. He was accompanied to HUD headquarters by Moore, the city housing director, and City Administrator Elijah B. Rogers, among others.

Barry also said he and Simons talked briefly about the city's newly disclosed plan to sell 56 boarded-up homes in the Deanwood Gardens project to moderate-income tenants rather than repairing and renting them. He said the discussion was inconclusive.

The level of federal subsidies for the city's projects was frozen in 1974 when the violations of HUD regulations were found. By March of this year, the city's maintenance crews had a backlog of morethan 17,000 requests for repairs that would take an estimated four years to complete.

In all, Moore's report to the mayor said 25 percent of the city's 11,284 public housing units had maintenance problems with varying levels of severity.