The Supreme Court ruled yesterday that municipal and county governments may be sued for violating federal antitrust laws when they regulate cable television or any other private business activity.

The 5-to-3 ruling means that companies denied cable franchises or, for example, trash-hauling contracts or airport operating agreements by a government, can now go to federal court to challenge a competitor's victory.

A flood of costly lawsuits is expected, which could affect the whole scheme of local cable franchise regulation around the country and interfere with dozens of other regulatory fields in which local governments permit potentially anticompetitive practices.

The threat of such suits, under which treble damages may be sought, likely will force local governments, often embroiled in influence-peddling and favoritism controversies, to be extremely careful in ensuring fairness in their procedures.

The ruling does not make any regulatory practice illegal or guarantee that plaintiffs can win their suits. It simply denies the blanket exemption from the antitrust suits sought by the cities and counties unless such an exemption is explicitly authorized by a state legislature, as it has been in 15 states.

The decision, written by Justice William J. Brennan Jr., does not affect localities, including those in Virginia, where the state controls most local regulation. It does apply to localities in the 40 states, including Maryland, that have broad home-rule regulatory authority.

The dissenters, led by Justice William H. Rehnquist, said the decision will "impede, if not paralyze, local governments' efforts to enact ordinances and regulations aimed at protecting public health, safety and welfare." Rehnquist was joined by Chief Justice Warren E. Burger and Justice Sandra Day O'Connor. Justice Byron R. White did not participate in the case for unexplained reasons.

A spokesman for the U.S. Conference of Mayors said the decision was "disturbing . . . . It sanctions the long arm of the law reaching down and seizing local powers."

"Even if local governments can beat some of these triple-damages suits," said National League of Cities lawyer Ross Davis, "the threat undercuts the ability of local governments to govern."

And if nothing else, the decision undoubtedly means more lawsuits. "It may take up the slack for the legal profession caused by the ATT and IBM antitrust settlements," suggested Glenn E. Weston, a George Washington University antitrust expert.

Yesterday's case, Community Communications Co., Inc., vs. City of Boulder, Colorado et al, stemmed from a controversy typical of the wars in this exploding industry. In 1964, the Boulder City Council gave a permit to Colorado Televents Inc., to provide cable service.

Because of technological limitations at that time, the service was confined to a small section of the city. But in 1979 the company informed the city it wanted to expand. By then, however, there were new competitors in the field and they, too, wanted to provide expanded service.

The City Council responded by declaring a moratorium on any cable expansion until it could draft a model ordinance and invite new businesses into the Boulder market. Televents Inc. sued under the Sherman Antitrust Act, charging that the moratorium illegally restrained its ability to compete.

In 1943, the Supreme Court said that states were generally exempt from federal antitrust laws under the theory that they have special regulatory powers protected in the Constitution by the concept of federalism. Boulder argued that cities with home-rule government, sanctioned by state legislatures, could share that immunity.

The 10th U.S. Circuit Court of Appeals agreed with Boulder, but the court reversed it yesterday.

Brennan said the state antitrust exemption embodies "the federalism principle that the states possess a significant measure of sovereignty under our Constitution. But this principle contains its own limitation. Ours is a 'dual system of government' which has no place for sovereign cities . . . ." The principle "makes no accommodation for sovereign subdivisions of states."

A state may delegate its exemption to localities, he said, but not through some generalized grant of home-rule authority. The state must explicitly single out the areas, such as cable television, that localities may regulate, he said, and the state must provide a "clear articulation and affirmative expression" of its desire.

Localities which have or can obtain from state legislatures an express grant of authority to regulate cable television or any other business may be freed of the threat of suits, he said.

Fifteen states already have effectively shared their immunity with a locality, by explicit legislation. But since many states would like to regulate cable television themselves, others may not be generous about sharing the power.

In a footnote, Brennan held out the possibility that localities might not be held to a strict reading of antitrust laws when they are sued. " 'Certain activities, which might appear anticompetitive when engaged in by private parties, take on a different complexion when adopted by a local government,' " he said, quoting from a prior court ruling.

Brennan acknowledged the claim that his ruling could have "serious consequences for cities and unduly burden the federal courts."

But that argument, he said, "is simply an attack upon the wisdom of the long-standing congressional commitment to the policy of free markets and open competition embodied in the antitrust laws."

Justice John Paul Stevens wrote a separate statement to take issue with the dissenters. But he said he agreed with Brennan's opinion, providing for the first time the five votes necessary to deny the antitrust exemption. A similar 1978 ruling failed to gather a majority of the court.

In other action yesterday:

The court ruled 6 to 3 that a campus policeman acted properly when he followed a Washington State University student, who was under arrest, into his room, found marijuana and filed a drug charge. The student, Carl Overdahl, had been arrested outside the dormitory carrying a contraband half-bottle of gin. The officer asked him for age identification. The student responded by allowing the officer upstairs while he searched for his I.D. When the two got there, the officer spotted the marijuana from the hallway, entered the room, seized the marijuana, and charged Overdahl and his roommate, Neil Martin Chrisman.

Chrisman charged that the officer entered and seized the marijuana illegally.

Chief Justice Warren E. Burger ruled that the entry was legal because the officer had placed Overdahl under arrest and properly could accompany him to the room. In addition, the marijuana was in plain view, he said, and therefore subject to seizure under prior court rulings.

Justices Byron R. White, William J. Brennan and Thurgood Marshall dissented.

The court dismissed as moot a major First Amendment case, Princeton University vs. Schmid. The question was whether Princeton could restrict the political activities of outsiders on the college campus.