The federal government, which has withheld $22 million in housing aid from the District government, agreed yesterday to release some of the funds after receiving assurances from the city that the money will not be mixed with general city revenues.

D.C. housing director Robert L. Moore told members of the city council's Committee on Housing and Economic Development Wednesday that the U.S. Department of Housing and Community Development was withholding the funds because the city cannot adequately account for money it has received and has mingled housing funds with general city funds.

HUD officials said yesterday that they would release $7.1 million for the long-awaited rehabilitation of the 267-unit James Creek public housing project at Half and M streets SW. after city controller Alphonse G. Hill promised to create a special bank account for all public housing modernization funds.

In a two-page letter delivered to HUD officials late Wednesday afternoon, Hill said his goal was to complete the complicated task of creating the new account within 60 to 90 days. HUD officials said if that schedule was not met they would withhold the money again.

HUD officials are still withholding $12 million of the city's Community Development Block Grant funds because the city has not corrected deficiencies in that program.

District officials were told three years ago that federal regulations required a separate bank account for public housing modernization funds. The city told HUD it was in compliance.

But earlier this month, when city housing officials notified HUD officials they were changing banks, the federal officials said they had discovered that the funds had been mixed. The city was told its request for James Creek funds would be held up.

City housing officials also said yesterday they had asked HUD for a supplementary $3 million grant for the 40-year-old James Creek complex because inflation has pushed up costs since HUD initially earmarked $7.1 million for the project in 1978. HUD officials said they would approve the additional amount to allow the city to award a construction contract.

The $12 million in Community Development Block Grant funds represents half of the $24 million the city is slated to receive this fiscal year. Normally, such grants are given in a lump sum at the beginning of the year. However, the District was notified last September that it would receive quarterly payments while it worked to correct several deficiencies, including its procedures for accounting for previous CD funds and awarding low-interest rehabilitation loans which come out of the block grant funds.