The Social Security old-age and disability trust funds are in good shape and will be able to pay all benefits for the next 50 years, but then will face deficits as the number of elderly persons increase, trust fund officials reported yesterday.

But the Medicare trust fund faces earlier difficulties becasue of rising health costs. It will go bankrupt by 1992 unless hospital costs are capped or new financing is found, the officals said.

And Social Security Commissioner Stanford Ross warned that the funds are not strong enough to permit any payroll tax reduction in the near future as many on Capitol Hill would like to do.

Outlining the annual report of the trustees of the Social Security System, Ross told a news conferrence that payroll tax and wage base increases voted by Congress in 1977 have restored the old-age and disability trust funds to a "sound" condition for the next 50 years-until the year 2030 for the two funds combined-assuming the economy moves along at a fairly healthy pace with unemployment averaging around 5 percent and inflation a bit under that over the five-decade period.

This would give Congress plenty of time to deal with projected deficits caused by the aging of the post-World War II baby crop. Over the next 75 years, the combined annual deficit of the two cash-benefit funds is projected at 1.2 percent of payroll ( $12 billion a year at current payroll levels). If unemployment and inflation are higher, however, the old-age fund could face exhaustion by 2016 and temporary cash-flow problems by 1983.

Ross also indicated that this year's cost-of-living increase for monthly old-age and disability beneficiaries will be about 9.8 percent, payable in checks received in July. Total disbursements by the two funds in fiscal 1979, which ends Oct. 1, are expected to be $93.1 billion.

Leonard D. Schaeffer, administrator of the Department of Health, Education and Welfare's Health Care Financing Administration, said passage of President Carter's hospital cost containment bill would keep the Medicare hospital fund solvent until the end of the century, rather than 1992 when it probably would be exhausted otherwise.

Ross said a pleasant note in the annual projections is that the disability trust fund is in better shape than had been expected because of slower growth in the disability rolls than projected. But he said this doesn't justify any cut in the basis Social Security tax. He said temporary problems might be solved by allowing the trustees to shift money from one trust fund to another.

The basic long-range problem in Social Security financing is the coming growth in the number of aged persons who must be supported by Social Security taxes paid by the working population 20 to 64 years old. Today there are 193 aged for every 1,000 persons of working age. By 2055 there will be 556