The owners and managers of a Northwest Washington apartment building agreed in D.C. Superior Court yesterday to pay multimillion-dollar lifetime medical expenses for a 9-year-old girl left semicomatose in 1976 when she rolled off a bed through a ripped screen in a fourth-floor window and fell to the ground.

Under a settlement agreement approved by Judge William S. Thompson, Valley Vista Management Company Inc. and the building's owners, 1343 Clifton Associates, agreed to buy an insurance policy so that Libra A. Robinson would receive adequate medical care.

In addition, the child's mother, Judy G. Barnes, will receive $20,000 under the terms of the settlement, and Barnes' lawyer, Jack H. Olender, will receive $250,000.

The D.C. government will receive $75,000 -- half from Olender and half from the defendants -- as reimbursement for more than $250,000 in Medicaid funds spent caring for the child while the suit, filed in 1977, was being litigated. The city has paid about $50,000 a year to care for the child.

The city, which generally intervenes in cases like this one, also will save millions of dollars in future Medicaid expenditures as a result of the settlement, according to John Suda, assistant corporation counsel.

Despite her four-story fall and severe injuries, the little girl, who is permanently hospitalized, has a life expectancy of 75 years, Olender said in an interview, so the total value of the trust is more than $38 million.

Olender said that under the settlement the owners and managers would purchase an insurance policy from a major insurance company which will pay monthly payments to the girl's court-appointed guardian. The payments will be $50,000 a year and will increase at a compound rate of 6 percent a year.

If the little girl lives another 66 years, as expected, the payment in the last year would be more than $2 million. Olender estimated such a policy would cost at least $1 million.

The child apparently was napping on a bed placed against a window when the accident occurred in July 1976, Olender said. The window was open because it was a hot day, he said. The child rolled off the bed and through the screen, which was ripped, he said.

In a $10 million lawsuit filed in April 1977, Olender cited a 1964 opinion by the U.S. Court of Appeals here which he said ruled that, in an urban setting, screens were meant to keep little children in as well as keep bugs out.

Olender said that had the case gone to trial he would have presented evidence that residents had complained to the management that screens in the building were defective but that the owners and managers had not acted to repair the screens.

In court papers, the owners and managers have consistently denied any responsibility for the accident, Olender said. Their lawyers could not be reached for comment yesterday.