President Reagan signed a bill to transfer St. Elizabeths mental hospital from the federal government to the District yesterday, saying it "will be in keeping with the modern practice of comprehensive programs for mental health care."

Under the new law, the city will take over management of the hospital in October 1987. The federal government will continue to subsidize the operation through 1991, while the city government works on developing a new city mental health system that emphasizes deinstitutionalization of St. Elizabeths patients.

Reagan said in a statement from Santa Barbara, Calif., where he is resting after the election, that St. Elizabeths "has played a historic role in American psychiatry" since it was established in 1855.

While the mental hospital served mainly federal beneficiaries for almost 100 years, now about 90 percent of the 1,700 patients and virtually all of the outpatients are District residents, Reagan said. He pointed to a "growing concern over the appropriateness of the federal government's operating St. Elizabeths primarily for the benefit of the District of Columbia."

This has been the federal government's argument for years in trying to get the city to take over the institution and in reducing federal subsidies for the hospital. District officials have said that the facility, on 336 acres in Southeast, is too large and expensive for the city's needs.

The compromise legislation was approved in the final days of Congress after intense negotiations between the federal and city governments and the hospital employes union.

It provides for $219 million in federal funds over a six-year transition period ending in 1991 and gives current hospital employes guarantees on priority in hiring, pay and benefits under the new District system.

The federal government will continue to pay indefinitely the cost of caring for patients sent to the hospital by a U.S. agency or those sent for assaulting federal officials. This would apply to the hospital's most famous patient, John Hinckley Jr., who has been held there since being found innocent by reason of insanity for the attempted assassination of Reagan in 1981.

"I am delighted that the president has signed this measure which will enable the District to design a mental health system which will best meet the needs of our residents," Mayor Marion Barry said in a statement. "This solves a problem which has been the subject of federal and District negotiations for more than 30 years."

City officials said this week they are creating a new Mental Health System Reorganization Office within the D.C. Department of Human Services, to be headed by mayoral policy aide Virginia Fleming.

A preliminary plan is to be sent to the mayor by April 1 and a plan outline to Congress by May, the officials said.