Congress yesterday approved a compromise bill to transfer all responsibility for St. Elizabeths mental hospital from the federal government to the District, ending the long-running fight over the future of the massive 127-year-old institution in Southeast Washington.

The House yesterday gave final approval to the measure as amended and approved by the Senate last week. The legislation now goes to the president, who is expected to sign it.

Under the bill, the city will take over the hospital and responsibility for its patients in October 1987.

By 1991 the District must have a comprehensive mental health system in place that will focus on caring for mental patients in the community -- in nursing homes, group homes, apartments or other alternatives -- rather than at St. Elizabeths.

Under a 1980 court order, as many St. Elizabeths patients as possible are to be moved into the community, or "deinstitutionalized," and this process has already begun. The hospital now has about 1,700 inpatients and 5,600 outpatients.

The White House supports the transfer legislation, which would provide federal funding totaling $219 million to the District for the hospital over a six-year transition period ending in 1991.

Some mental health experts and hospital employes, whose futures are up in the air, have qualms about the changeover, however.

"They D.C. officials are very far behind in fulfilling their commitment to the original plan" for providing care to deinstitutionalized patients, said Norman Rosenberg, director of the Mental Health Law Project, which was instrumental in winning the 1980 court order.

"We are wary of their ability to undertake this task . . . and absorb an even greater responsibility," he said.

Gladys B. Baxley, D.C. mental health administrator, said the city hopes to have an outline of its mental health plan by spring and that she is optimistic the city can successfully incorporate St. Elizabeths into the city system.

"We have a golden opportunity to build a comprehensive system for the District. We have no intention of decimating the programs at St. Elizabeths," Baxley said.

But it is too soon to tell how many patients eventually will remain institutionalized and how many employes will be brought into the District's new system, she said.

"I recognize there is a lot of anxiety around that issue" of future employment among the more than 3,000 professional, support and maintenance staff, Baxley said. "Many will be coming into the District system. . . . How many there will be we really don't know."

This lack of certainty is of considerable concern to the hospital staff, particularly since the city could choose to contract out a number of services and leave employes with few job protections, said Bill Welsh, legislative director for the American Federation of State, County and Municipal Employees.

Provisions requiring contractors to give current workers priority in hiring have "no muscle," he said. AFSCME signed off on the negotiated legislation as the best it could accomplish for its members, despite the union's concerns.

The legislation provides that current employes will get priority hiring in the new D.C. system and would be guaranteed their seniority, pay and benefits if they are taken into the new system.

The compromise legislation, hammered out over recent months during intense negotiations between the federal and city governments and the hospital employes union, will resolve a longstanding controversy over future management and funding of the facility.

The federal government has been trying for years to turn over St. Elizabeths to the D.C. government, which has said it does not want it and cannot afford it. The federal government says most of the patients are District residents, while the city says many of the patients are drawn to Washington only because it is the nation's capital.

The hospital currently has an annual operating budget of about $143 million, "more per capita than any mental health system in the nation," according to Sen. Thomas Eagleton (D-Mo.), ranking minority member of the Senate Governmental Affairs subcommittee on D.C.

When the transition is through and the new city system is in place, St. Elizabeths probably will be a smaller institution with fewer patients, city officials and mental health experts say.

Rosenberg, of the mental health project, said 400 St. Elizabeths patients already have been identified as qualified to be moved from the hospital and that eventually 30 to 50 percent of those remaining could live in less restrictive settings.

His group forsees a hospital for between 500 and 700 patients, rather than the nearly 2,000 there now. Baxley said building a smaller facility elsewhere in the District is one option to be considered.

Some of the property, 104 buildings on 336 acres in Southeast Washington, could be used by the city for purposes other than mental health, but the uses would have to be consistent with a historical landmark designation.

Property to be used for mental health will be turned over to the city in 1987. The city is to come up with a plan for use of other property, and Congress would either approve the plan or the federal government would retain the property.

The final resolution on the future of the hospital will free up $20 million in federal funding in the District's 1985 appropriations bill, still awaiting final congressional approval, which was made contingent on adoption of such a plan.

The federal government will continue to pay the cost of any patients its agencies send to St. Elizabeths or for persons like presidential assailant John Hinckley taken there after threatening or attacking federal officials, the White House or the Capitol.