The District of Columbia has spent nearly $400,000 in federal money paying delinquent electric and gas bills for landlords so service would not be shut off to their tenants, but now federal officials say the city was not authorized to use the money for this purpose and must somehow recover it.

This federal decision leaves the city with "grossly inadequate" funds with which to intervene when the utility companies cut off service to one of the city's more than 4,000 apartment buildings, according to Lorenzo W. Jacobs Jr., director of the city's Department of Housing and Community Development.

Jacobs disclosed the federal action in a letter to the D.C. Public Service Commission, which held hearings Monday on whether it should forbid utility cutoffs to apartment buildings in cases where landlords fail to pay utility bills even though money to cover them is included in rents they collect from tenants.

"In our judgment, the health and safety of people is overriding and . . . the possibility of a large building being left without heat and hot water is a circumstance which can and must be averted," Jacobs wrote in endorsing commission action to forbid cutoffs.

While the commission considered the question yesterday, Potomac Electric Power Co. cut off electric service to a four-unit apartment building in Southeast Washington because the landlord was $6,000 behind in paying his electric bills. Today the District is prosecuting a landlord in D.C. Superior Court in an effort to make hime pay a utility bill.

Although the city is planning legal action against many landlords, officials are not sure they will be able to recover much of the $400,000 from the landlords. Failing that, the city will have to find the money somewhere else so it can be used in authorized programs.

Procedure for shutting off electricity to four apartments is elaborated. C1.

The money was part of $123 million the city received from HUD during the past three years to use in community development programs, according to Hanna L. Schussheim, HUD's community development representative for the Washington area.

"It is an unauthorized use," Schussheim said of the payments to Pepco and Washington Gas Light Co. She said the money could be used to make repairs and to refurbish buildings, but not to pay utility bills.

Schussheim said the city's use of the money to pay utility bills came to light last spring when the city wanted to pay a large utility bill at Clitton Terrace Apartments, the controversial and rundown complex then owned by PI Properties, the real estate affiliate of the black self-help organization Pride Inc.

HUD wrote Jacobs April 11 saying that such a use of the money was unauthorized and demanding a list of all utility bills the city had paid. The letter also demanded that the city "reprogram" the money into HUD-approved programs, but did not suggest how the city should recover the money it had paid to the utility companies.

The result of all this is that "people could conceivably be left for a long time" without electricity or gas after cutoffs, according to Abraham Greenstein the deputy administrator in the neighborhood improvement division of Jacob's housing department.

According to Greenstein and Jacobs' letter, the HUD decision means the department has only $70,000 in its own funds that it can use to pay utility bills when there is an apartment utility shutoff. Since some of the delinquent bills run as high as $50,000, the department can no longer meet many of them.

Greenstein said, for example, that the department will not pay the $6,000 utility bill on the Southeast building where electricity was shut off yesterday - even though it would have in the past.Now, he said, the department will pay current bills for the building for two weeks while Pepco negotiates with the landlord over payment.

"During that time we hope the owner will find money," said Greenstein. "If not, service will be terminated again."

Greenstein said all this constitutes "a crisis" because there are "an awful lot of buildings" in the city on the verge of having their utilities cut off.