The Justice Department has agreed to settle a major price-fixing case against four big gypsum companies on terms that critics say amounts to allowing the defendants to buy their way out of prosecution.

Under the terms of the unprecedented settlement, which is to be presented to a federal judge in Pittsburgh tomorrow for approval, the government will drop prosecution of the four companies if they pay the government a portion of the taxes they would have owed if convicted.

Critics are concerned that, besides appearing to sell justice, the settlement will make it more difficult for private plaintiffs to recover damages from the companies and that any possible damages might be tax-deductible.

"It leaves me with a very bad taste in my mouth," said Maxwell M. Blecher, a widely known Los Angeles antitrust attorney who specializes in private suits. "This could also be viewed as allowing criminal defendants to buy their way out if they can pay enought. It doesn't leave me with a good sense about the justice system."

John Flynn, a law professor at the University of Utah, said the government "won some points for bringing the case, which was highly visible," but added that it is "extremely difficult to determine why they aren't pressing forward. I wonder about the consequences."

A knowledgeable antitrust attorney went even further. "I think it's outrageous for the government to pull this off," said this attorney, who had years of government experience. "There's not going to be a single defendant who goes in and doesn't try to adopt this scheme."

The agreement involves United States Gypsum Co., Naitional Gypsum Co., Georgia-Pacific Corp. and Celotex Corp., a subsidiary of Jim Walter Corp. Executives of the companies named in a 1973 indictment did not contest the charges and were either fined or given suspended prison sentences. Two other companies, Kaiser Gypsum Co. and Flintkote Co., pleaded no contest to the charges.

The four companies were found guilty of price-fixing by a jury in 1975 after a 19-week trial. Those convictions were overturned by an appeals court on grounds related to the "meeting-competition" provisions of the Robinson-Patman Act and the trial judge's instructions to the jury.

But when the Supreme Court affirmed the appeals court ruling in 1978, the case was sent back to the government for retrial, and tomorrow before U.S. District Judge Hubert kTeitelbaum the government is expected to offer the agreement instead of retrying the case.

Word of the proposed plan may already be touching off the first public crisis for the new chief of the department's antitrust division, Sanford M. Litvack.

"Like every recent assistant attorney general before him, Mr. Litvack gave a tough speech against price-fixing as really his first act in office, but if reports of this settlement are true, he is proving himself more tame than tough on alleged criminality," said Mark Green of Congress Watch.

The case revolves around charges that between 1960 and 1973, a period when the government said the companies had a market share of about 90 percent and sales of more than $4 billion, they violated the Sherman Act in one of the broadest price-fixings ever revealed.The elaborate plan involved pressure tactics, a variety of coverup schemes and intricate joint of pricing systems, the goverment said.

Since gypsum is a building material widely used in the construction of walls and ceilings, and is therefore contained in homes and offices across the country, the government has said that the conspiracy cost the public millions of dollars in artificially high prices.

Already the gypsum companies have agreed to pay $70 million in damages in a variety of other civil antitrust suits. If the companies were convicted of price-fixing in the government's case, two-thirds of that figure would be deductible. Otherwise those damage claims would be totally deductible.

In situations of this kind, the antitrust division usually considers a variety of arguments about bringing a case a second time, such as the costs of a retrial, the clarity of the memories of key witnesses, the benefits to the government, and what the government might recover if the defendants are ultimately convicted. In this case, each defendant could be handed a $50,000 misdemeanor fine.

Further complicating the Justice Department's decision is the fact that the antitrust division has lost several key trial attorneys who worked on the original case, including the lead attorney, John Fricano, who is now in private practice here.

Department officials will not comment on the settlement, although it was learned that they have said that the government has less than a 50 percent chance of winning convictions in a second trial.

Informed sources say the agreement calls for the four companies to settle the case in exchange for a payment to the Internal Revenue Service of a percentage -- reportedly less than half -- of the back taxes that would have been owed the government if there had been a conviction. If the companies were acquitted, the government could not collect the back taxes.

The IRS reportedly said in 1975 when the trial ended that the tax liability of the four companies was under $25 million. With interest that figure could approach $30 million.

But sources point out that since the firms retained those funds they were able to earn an amount greater than the total of the penalty to be proposed tomorrow.

A key figure in the case, the individual credited with blowing the whistle on the gypsum companies' practices, is Claude Huckleberry, a one-time gypsum industry executive. He says he is outraged at the government's decision not to prosecute.

Huckleberry, who says he was repeatedly asked by the government not to file a major damage suit because he was the prosecution's key witness, says Justice Department officials have lied to him about their plans for handling the retrial and says he will fight any settlement the judge accepts.

The proposed settlement would be particularly damaging to Huckleberry, because if, as he says, he were to file a damage suit against the companies, he would have to prove his case from scratch. If the firms were convicted he could base his claim almost completely on the government's evidence. Other potential plaintiffs would face the same situation.

Huckleberry is founder and former president of Texas Gypsum Co., and has led a 20-year fight to expose the industry practices. Huckleberry, who says he was forced to sell his share in the business to a partner and now is a Kansas builder, threatens to "fight" the government just as hard as I ever fought the gypsum companies" if the settlement is accepted.