Lawyers representing almost every major supermarket chain in the nation gathered in federal court here last week to seek dismissal of a massive antitrust suit that could cost the supermarkets tens of millions of dollars in damages if they go to trial and lose.

The supermarkets--including Safeway, Giant and A&P--are defendants in a long-running nationwide antitrust case in which cattle ranchers accuse them of conspiring with packing houses to hold down the prices paid to ranchers for beef cattle.

The complex case, developed after years of research by an Iowa-based organization of ranchers called the Meat Price Investigators Association, challenges every facet of the beef industry's price structure. According to "Prime Rip," a recent muckraking book about the beef industry, a victory by the ranchers "would call for a total overhaul of the American meat industry."

The supermarkets are trying to extricate themselves from the case without having to stand trial at all, which would remove a threat of massive damage assessments that has hung over them since the suit was filed in the mid-1970s.

Safeway noted in its recent annual report to stockholders that loss of the case "would require very large expenditures." According to lawyers familiar with the case, that is an understatement, because the suits against the supermarkets allege that the price-fixing conspiracy dates back to at least 1963, and if a trial should result in a finding against the stores, any damages awarded would be trebled automatically.

But the issue in the hearing before Judge Patrick Higginbotham was not whether the supermarkets are rigging cattle prices. It is whether they can be sued by the ranchers or are shielded from by the Supreme Court's landmark 1977 ruling known as the Illinois Brick case.

In Illinois Brick, the high court ruled in effect that only direct purchasers or sellers, not indirect or down-line purchasers or sellers, could be held liable for antitrust damages. In the Dallas case, the supermarkets are seeking the shelter of Illinois Brick to try to escape from the antitrust case filed by the cattle ranchers, arguing that only the packing houses--the direct purchasers--are liable to suit, not the supermarkets.

The Illinois Brick ruling was criticized strongly by consumer groups and state governments, who said it would limit the ability of buyers to sue subcontractors and suppliers who might be fixing prices. Legislation to override Illinois Brick was reported out of the Senate Judiciary Committee but never was brought to a vote on the floor.

Shortly after the Supreme Court ruling, the case against the supermarkets was dismissed on the ground that the cattle ranchers were not "injured parties" with standing to sue under the ground rules laid down by Illinois Brick. But the U.S. Court of Appeals for the Fifth Circuit reinstated the case in 1979, saying the trial court should decide whether, as the ranchers argue, the packing houses are merely "conduits" who pass through a price that actually is set by the supermarkets.

The cattle ranchers, who were represented by Lex Hawkins of Des Moines, Iowa, say the price they get from the packing houses is determined by the so-called Yellow Sheet, a meat-price report based in Chicago, and that price in turn is based entirely on what Safeway and A&P say they will pay for beef in a given week.

Stephen Axinn, a New York lawyer who argued the case for the supermarkets, said the Court of Appeals reinstated the case to give the ranchers an opportunity to prove an "automatic, push-pull, click-click pass-through" by the packers of prices set by the supermarkets. But he said that affidavits and price records filed in the case show that "there is no evidence of a fixed, immutable consistently applied formula anywhere in the United States."

Hawkins argued that the packing houses pay the ranchers exactly the price they get from the supermarkets, or less.

If Judge Higginbotham grants the supermarkets' motion to drop them as defendants, the ranchers will be left with a case only against the major packing houses, primarily the Iowa Beef Processors subsidiary of Occidental Petroleum Co. and the MBPXL subsidiary of Cargill Inc. The judge promised to rule on the motion by June 14.