District of Columbia officials, already struggling to avert a deficit this year, said yesterday the city would have to spend at least $50 million more than it can afford next year under President Reagan's 1984 budget proposal.

Reagan's plan would require that the city spend about $39 million more than Mayor Marion Barry has proposed to treat mentally ill patients at St. Elizabeths Hospital and increase by $12 million the District's contribution to the federal civil service retirement program, which covers about 26,000 of the city's employes.

The added spending requirements, which caught some city officials by surprise, would more than offset the $25 million increase in the federal payment to the District that the president recommended in the budget he sent to Congress yesterday.

The proposed $386 million federal payment, in compensation for services provided to the federal government, is the full amount sought by the city.

"We're entirely pleased about the federal payment," said Elizabeth Reveal, the D.C. budget director. "While there appear to be some differences between the executive branch and the District with respect to St. Elizabeths and the retirement system proposal, we are optimistic [we can work out a compromise] through continued discussions."

But Reveal acknowledged that the city's problems could be further compounded by Reagan's proposals to reduce federal grants to cities for housing, transportation and Medicaid.

"All of our 1984 federal grant assumptions were based on maintaining 1983 levels of support," said Reveal. "That's a problem [in light of Reagan's proposal.]"

In putting together the mayor's 1984 budget proposal, city officials assumed they would also receive about $388 million in federal grants, with about a third of that in the form of Medicaid reimbursements.

Officials now say that the total could be substantially less than that, making it increasingly difficult to balance the budget.

Reagan's new budget proposal also includes authority for the city to borrow up to $115 million from the Treasury next year to finance capital improvement projects.

However, the city no longer would be allowed to obtain interest-free short-term loans from the Treasury to cover temporary cash shortages.

Barry's administration anticipated this proposed change in Treasury policy and set aside about $5 million in its 1984 budget to cover interest costs in obtaining short-term loans from private financial institutions.

But city officials didn't anticipate President Reagan's proposal that the city sharply increase its contribution for patient care at the federally operated St. Elizabeths Hospital.

The Office of Management and Budget (OMB) has eagerly pushed to have the District assume a much greater share of the cost of running St. Elizabeths.

Late last year, it urged the president to make deep cutbacks in federal aid that would result in the layoff of 825 full-time staff members and a sharp decline in psychiatric care for inpatients.

The new budget reflects Reagan's decision to reject OMB's proposed cuts and to maintain the current level of services at St. Elizabeths, but to seek legislation that would transfer the facility to a nonprofit corporation, a Department of Health and Human Services official said yesterday.

Meanwhile, the official said, the Reagan administration intends to gradually increase the District's share of the cost of treating mentally ill patients at the hospital.

The city currently provides approximately $24 million, or about 19 percent of the hospital's $128.4 million annual operating budget, to defray the cost of treating patients who live in the District.

Mayor Barry proposed spending $29.5 million on St. Elizabeths in 1984, but Reagan has recommended that the city pay a total of $68.6 million.

The city probably would be reimbursed about $14 million of that total through the Medicaid program, according to city and federal officials. An additional $12 million might be saved if the city transferred about 250 St. Elizabeths patients to area nursing homes, in line with a court order aimed at deinstitutionalizing patients at the facility.

The proposed increase in the District's pension cost stems from Reagan's plan to alter the federal civil service retirement program to reduce the federal government's overall costs.

While the District, with the advent of home rule, set up its own pension programs for police, firefighters, teachers, judges and employes of the University of the District of Columbia, more than half the city's work force remains under the federal civil service retirement program.

The city currently contributes 7 percent of those employes' wages and salaries to the federal civil service retirement fund, while the federal government contributes an amount equal to21 percent of the D.C. government payroll.

"This constitutes a hidden subsidy to the D.C. government -- one that is not intended," according to a Reagan budget document.

Reagan has proposed that the city's contribution be increased to 9 percent effective Oct. 1, 1983, and to 11 percent effective Oct. 1, 1984.

If Congress approves the recommendation, the city would have to pay an additional $10 million to the federal fund next year and considerably more the following year.

An official of the D.C. Retirement Board said yesterday that he wasn't certain where the mayor or the City Council could find the extra money to cover Reagan's proposal.

"They [city officials] already are scrounging around for a million here and a million there," the official said. "This would really ruin their budget."