The D.C. government, finally free of a controversy over the legality of its home rule charter that delayed plans for major borrowing in the private market, has received the highest ratings possible for obtaining short-term loans, the city announced yesterday.

The District, which plans to borrow $150 million this month against anticipated 1985 tax revenues, received the highest credit-worthiness ratings for short-term borrowing from Moody's Investors Service and Standard & Poor's, the nation's foremost municipal finance rating services.

The top ratings are important because they indicate the city has a strong system of cash flow and reserves. They also will enable the District to pay the lowest possible interest rate for short-term loans, which must be repaid by the city within a year.

"There are very few cities on their first outing that get the highest rating," Mayor Marion Barry said in announcing the ratings at his monthly news conference. " . . . Obviously, it will help us get a lower interst rate."

However, the ratings apply only to short-term borrowing, and the city is not guaranteed of receiving the same high ratings for marketing long-term bonds to finance capital improvements, according to an official of Moody's.

"There are other, longer-term considerations that come into play when we look at [capital improvement] bonds for the District," said George W. Leung, Moody's vice president for municipal bond research.

In determining a bond rating, the analysts must consider not only the adequacy of the District's cash flow, but also such factors as the city's unfunded pension liability, its obligations in helping to subsidize Metro, its correctional and hospital costs and debt service.

In a major victory for the District, Congress gave final approval last week to legislation removing a legal cloud from the city's decade-old home rule charter and making it more difficult for Congress to overturn local legislation.

The ruling freed the city to issue nearly $600 million in tax-exempt bonds and notes authorized by the City Council last summer.

The planned borrowing includes issuance of the $150 million in short-term notes needed to give the city cash while it waits for tax revenues to come in, and $167.5 million in bonds for fiscal 1985 for capital construction projects.

Also, $277.4 million in bonding authority was granted to refinance 30-year Treasury notes from 1981 and 1982 at lower interest rates. The refinancing was estimated to bring a saving of $20 million in interest.

The D.C. government traditionally has been dependent on the U.S. Treasury for most of its borrowing. The city had planned to begin borrowing on its own in the private market last year, before the controversy over the home rule charter arose.

The city did manage to borrow $150 million in short-term notes in the last fiscal year, but with the help of the Treasury. The notes were sold to the First National Bank of Chicago at an annual interest rate of 6.6 percent. The Treasury agreed to pay principal and interest on the notes if the District, for legal reasons, were unable to repay the loan.

Hyman C. Grossman, managing director of Standard & Poor's, said his firm's top "SP 1-plus" rating for short-term borrowing by the District was granted in part on the assumption that the city could turn to the Treasury for help if it ran into difficulty in repaying the loan.

"We're making a judgment call that that won't happen," Grossman said. " . . . But if it the backing of the Treasury weren't there, I think it would have been more difficult for the city to achieve the SP 1-plus."

During his news conference yesterday, Barry declared that the D.C. government has enjoyed "a banner year" on Capitol Hill with the resolution of the home rule controversy, approval of a record 1985 federal payment to the District of $425 million, and enactment of legislation transferring St. Elizabeths Hospital from the federal government to the District.

The mayor held a reception last night at the District Building to celebrate the city's victories on Capitol Hill. Among the guests were White House counselor Edwin Meese, who helped work out a compromise on the city's charter legislation, and U.S. Attorney Joseph diGenova, who has been at odds with the mayor over home-rule issues.