The Supreme Court, stating that "harsh" prison conditions are the price of crime, ruled yesterday that prison overcrowding is not forbidden by the Constitution.

The 8-to-1 ruling set new limits on the power of federal judges to order sweeping prison reforms, as they have done in 24 states, including Maryland. At a time when state treasuries are low and prisons increasingly crowded, the decision also offered some potential relief for state governments against future court-ordered expenditures to improve prisons.

"The constitution does not mandate comfortable prisons," Justice Lewis F. Powell Jr. wrote for the majority. It does not require meeting "an aspiration toward an ideal."

The immediate impact of the ruling on states under court order will probably be limited by the narrow facts of yesterday's holding. It involved double-celling of inmates in small rooms in an Ohio prison that was otherwise considered relatively modern. That sort of overcrowding, where other conditions are in order, is clearly not unconstitutional, the court said.

Beyond that, however, the court for the first time attempted to define what constitutes the "cruel and unusual punishment" barred by the Eighth Amendment for convicted criminals in the nation's prisons.

Its definition rejected the argument of prison reformers that overcrowding and harsh conditions were constitutionally questionable because they go beyond the punishment -- simple confinement -- mandated by an inmate's jail sentence.

Conditions may be cruel and unusual if they breach "thee contemporary standard of decency," Powell wrote. "But to the extent that such conditions are restrictive and even harsh, they are part of the penalty that criminal offenders pay for their offenses against society." The level of comfort in prisons should be determined by state legislatures and prison administrators, he said, not the courts.

The court did give its strong support to continued scrutiny of prison conditions by federal judges. Alvin Bronstein, head of the American Civil Liberties Union's National Prison Project, said that support stood out in an otherwise "negative" decision for his cause.

Yesterday's case, Rhodes v. Chapman, had been labeled the "one man, one cell" case. It stemmed from a challenge to housing two men in cells of 63 square feet each (a typical door, laid flat, takes up 20 square feet) at an Ohio maximum-security prison built in the early 1970s.

Federal standards call for a prison capacity of 60 square feet per inmate and the Ohio prison, which housed 2,300 inmates at the time the suit was brought, was considered 38 percent over its intended capacity.

While these conditions resulted in lessened rehabilitation opportunities for each inmate, the prison was otherwise relatively well-equipped with gyms, workshops, school rooms, chapels, a hospital ward, recreation field and library. The cells had two-tiered bunks, heating and air circulation vents and many had windows.

Nevertheless, a U.S. District Court, later upheld by the 6th U.S. Circuit Court of Appeals, ruled the prison unconstitutional under the Eighth Amendment and ordered relief for the inmates. The lower court cited, among other things, American Correctional Association and other penologists' standards for prison conditions.

Powell stressed that, under the Constitution, courts should scrutinize prison conditions. But the lower-court ruling in the case was "insupportable," he said, because the double-ceiling by itself was not a severe enough deprivation.

"Conditions that cannot be said to be cruel and unusual under contemporary standards are not unconstitutional," he wrote. Those standards should be a objective as possible, he said. The infliction of "wanton" physical pain would be cruel and unusual, he said. So might denial of medical care, essential food or sanitation.

Prison conditions may not be "grossly disproportionate to the severity of the cime," he said.

But prisons housing "persons convicted of serious crimes cannot be free of discomfort," he said. ". . . Courts cannot assume that state legislatures and prison officials are insensitive to the requirements of the Constitution . . . ." Official standards promulgated by correctional organizations also should not dictate constitutional judgments.

Chief Justice Warren E. Burger and Justices Potter Stewart, Byron R. White and William H. Rehnquist joined Powell's opinion. Justice William J. Brennan Jr., with Harry A. Blackmun and John Paul Stevens filed a separate concurrence. Blackmun also wrote separately. Justice Thurgood Marshall dissented.

Brennan underscored the continuing responsibility of the courts to monitor prisons. "Today's decision," he said, "should in no way be construed as a retreat from careful judicial scrutiny of prison conditions."

Blackmun said the ruling should not be a "signal to prison administrators that the federal courts now are to adopt a policy of general deference to such administrators and to state legislatures. . . ."

Marshall disagreed. "The majority today takes a step toward abandoning" the oversight role, he wrote. "In the current climate, it is unrealistic to expect legislatures to care whether the prisons are overcrowded or harmful to inmate health," he said. Blue Cross Ruling

In another important ruling yesterday, the court effectively eliminated what health-care planners considered a major tool to control health-care costs and overbuilding of hospitals.

The justices ruled unanimously that Blue Cross, the nation's largest provider of health insurance, can be sued for antitrust violations for denying full participation to hospitals it considers unnecessary.

Blue Cross' approach is designed to discourage overbuilding, which is said to be a major cause of skyrocketing medical costs, by making surplus hospitals unprofitable for their operators. A denial of full participation in Blue Cross means that hospital costs for Blue Cross subscribers will not be fully covered. Millions of people are thus discouraged from patronizing a hospital so penalized.

Under yesterday's holding, Blue Cross or any other private insurer faces enormously costly, treble-damage antitrust suits in any future such denials. Though the case involved only one company, Blue Cross, that one company is so large that anything it does effects the entire health-care industry.

The company's technique was considered especially important in controlling medical costs because of the Reagan administration's plans to cut back on government regulation of hospital construction.

If the government cuts back on regulation -- such as planning and issuance of certificates of need for hospital construction -- private insurers will be among the few agencies with the power to prevent costly duplication of services. Yesterday's decision will make that difficult, if not impossible.

The justices said yesterday that Blue Cross' actions were voluntary and not a part of any government-sanctioned regulatory scheme that might exempt it from the law.

The case presented a classic conflict between antitrust policy, designed to encourage maximum free-market competition, and the need to regulate an industry considered out of control by many experts.

Health planners argued that cooperation within the industry was essential to control costs. While it might be considered "collusion" under antitrust law, the planners argued that antitrust law should not interfere.

The Justice Department, among others, countered that such antitrust immunity would have a "substantial adverse impact on competition" in a sector of the economy that employs 5 million people and spends $200 million a year.

Yesterday's case began when Blue Cross of Kansas City denied full participation to a general-care hospital opened there in 1978. Blue Cross based its decision on the failure of the hospital, National Gerimedical Hospital and Gerontology Center, to secure the approval of a regional hospital planning agency set up to control medical services.

The hospital sued Blue Cross. Under ordinary circumstances, a measure effectively putting a hospital out of business might be a clear antitrust violation. But lower courts, holding that Blue Cross' action was exempt from antitrust laws, said the National Health Planning and Resources Development Act of 1974, enacted to encourage controls on the supply of medical care, signaled Congress' intent to immunize the field from antitrust laws.

Powell, writing for the court, noted that the court had confronted claims of antitrust immunity in numerous cases and has always found antitrust to be a "'fundamental national economic policy'."

Immunity should be granted only where Congress has clearly indicated its preference, he said. In the Blue Cross case, Powell said, Congress did indeed encourage the states to develop agencies and regulations to prevent a glut of medical care.

But the insurance company acted on its own in denying full participation to National Gerimedical, he said. Its action was not mandated by the 1974 act. There was no request or order from any regulatory agency requiring the company to do what it did.

Therefore, the company cannot enjoy the immunity that might be extended to a legally established agency of the sort that most states now use to control hospital construction.

"Antitrust repeals are especially disfavored where the antitrust implications of a business decision have not been considered by a governmental entity," Powell said.

The ruling does not interfere with state programs and planning agencies controlling construction through "certificates of need." Powell suggested that regulatory actions taken under the 1974 act might, in fact, be immune from antitrust challenge.

In passing that law, he said, Congress may have felt that "competition was not a relevant consideration in the health-care industry. If so, although that industry is not regulated in any comprehensive fashion, it might be concluded that Congress intended 'pervasive' cooperation and planning without the interference of antitrust suits."