A federal appeals court ruled yesterday that Maryland officials can temporarily ease overcrowding in the state's beleaguered prison system by placing two inmates in some cells meant for one person and double-bunking others in already full dormitories.

The U.S. Appeals Court in Richmond, citing a June decison by the Supreme Court that the Constitution "does not mandate comfortable prisons," said that Maryland had not violated the constitutional rights of prisoners by double-bunking and double-celling at several newer state facilities in order to relieve pressure at older prisons.

The 6-to-3 appeals court decision overturned two recent rulings by U.S. District Court in Baltimore. In one of those rulings last April, Judge Alexander Harvey II denied a request by the state to double-bunk prisoners in four dormitories at the Maryland House of Correction in Jessup and double-cell others at the prison's recently opened annex. The other District Court ruling imposed a $3,800-a-week fine against the state for failing to comply with past court orders.

Maryland officials, who have been under federal court order since 1978 to end prison overcrowding, had not seen the appeals court decision yesterday and were cautiously optimistic that the ruling would end a complex and tangled three-year court case involving conditions at three state prisons in Baltimore, Jessup and Hagerstown.

"This decision is gratifying to us," Gov. Harry Hughes said yesterday. "We would prefer there would be no need for double-celling and similar measures but such measures are certainly preferable to the premature release of inmates who are not prepared to rejoin society."

Yesterday's decision will likely take substantial pressure off the Hughes administration in an area that for much of the last three years proved politically explosive. Only in the last few months has the pressure eased as Hughes replaced his top corrections officials, moved toward stricter prison policies and showed an apparent willingness to build a new 500-bed medium-security prison.

The decision does not immediately eliminate the overcrowding problem in the state, however. There are currently 8,648 inmates in a prison system that the American Corrections Association says should house fewer than 7,000 in single cells. Officials in the Department of Public Safety and Correctional Services, however, say the prison system can actually hold 8,200 or 8,300 inmates.

Bill Clark, a spokesman for the Corrections Department, said yesterday that some 500 prisoners are currently housed in overcrowded conditions -- at the Jessup Annex, on basketball courts and temporary buildings at the Maryland Correction Institute in Hagerstown in and the Baltimore Diagnostic Center.

However, he said much of that problem will be eliminated soon when a new diagnostic center in Baltimore is opened. "They have them swinging from the chandeliers in the current facility ," Clark said. The state also recently broke ground for another 528-bed "annex" to the House of Correction in Jessup.

In its decision yesterday, the appeals court noted that Maryland officials have made a "good faith effort" to eliminate prison overcrowding since the 1978 court order. But because of delays in prison planning and construction during the last few years and an influx of inmates, the state has been forced to come up with other temporary methods for housing prisoners.

"The proposal for double celling and double bunking was the result," the court said. Because the doubling up of prisoners was proposed for a new facility where cells are larger and in better physical shape than older prisons "the conditions . . . met the standards found to be constitutional" by the Supreme Court in its June ruling on an Ohio overcrowding case.

In regard to the double-bunking in the four House of Correction dormitories, the appeals court said evidence showed the facility to be clean and "the actual space available to each inmate will remain substantially the same."

Paul D. Bekman, a lawyer for the prisoners who brought one of the class action suits that resulted in the 1978 court ruling, said yesterday he had not yet seen the appeals court decision and could not comment.