A federal bankruptcy judge ruled yesterday that the Justice Department used "trickery, fraud and deceit" to steal a computer software program developed by a Washington company and then attempted to drive the company out of business.

In a decision that at times was sarcastically critical of the Justice Department's handling of the case, Judge George F. Bason Jr. said he was disturbed by the department's failure to investigate allegations by the company, Inslaw Inc., that several department officials -- one of whom had been fired by Inslaw -- were biased against the company.

"The failure even to begin to investigate is outrageous and indefensible and constitutes an institutional decision by the Department of Justice at the highest level simply to ignore charges of impropriety," Bason said. "It was obvious to me ... that the entire Department of Justice was in a circle-the-wagons defensive attitude."

Bason's ruling came in a complicated, 2 1/2-year-old case in which Inslaw charged that it was driven into bankruptcy by a vendetta by Justice Department officials. The company maintained that the department improperly claimed ownership of a software program called Promis that was developed by Inslaw to track cases in U.S. attorneys' offices.

The judge ordered the government to pay Inslaw for the use of the software beyond the contract's specifications. Inslaw estimated the government owes the company about $5.4 million in software licensing fees. The government was also ordered to pay the company's legal fees, which an Inslaw attorney estimated at about $500,000. Bason said he would decide at a later date about other damages, although he said he was unsure the federal government could be held liable for punitive damages.

The Justice Department said it would appeal the judge's decision to the U.S. district court. "We believe strongly that we are correct, that the department's conduct was lawful and proper," a spokesman said.

Inslaw Chairman William A. Hamilton said, "We're very pleased and hope that this will be the beginning of the healing process." Hamilton said that because the judge ruled that Inslaw, and not the government, owned the Promis software that had been at the center of the dispute, the company was in a better position to submit a plan for reorganization under federal bankruptcy laws. Hamilton said Inslaw hoped to submit its reorganization plan before the end of the year.

Inslaw filed for bankruptcy in February 1985 after the Department of Justice stopped payment on the contract for the case-tracking software, contending that Inslaw had not lived up to the contract. Inslaw then sued the government, claiming that bias by Justice Department officials had interfered with the contract.

The case turned on two questions: whether Justice Department officials were biased against Inslaw and whether the department used advanced versions of Inslaw's software without paying the company.

The central figure in Inslaw's charges was C. Madison Brewer III, who oversaw the Promis contract for the Justice Department's executive office for U.S. attorneys. Brewer was formerly general counsel for Inslaw, but left the company in 1976 to go to the Justice Department.

Inslaw contended that Brewer was fired; the government said he resigned. But Bason ruled, "It is simply impossible for this court to accept Mr. Brewer's testimony that he didn't know he was being fired. ... It's not the sort of thing one can have a misunderstanding about."

As a result, Bason said, "Mr. Brewer, believing he had been wrongfully discharged by Mr. Hamilton and Inslaw, developed an intense and abiding hatred for Mr. Hamilton and Inslaw. ... Mr. Brewer's actions over the course of this contract, it seems to me, just shouted bias."

Bason ruled that Brewer made several attempts to break the contract between Inslaw and the department, and that Brewer's assistant and the contracting officer directly involved with Inslaw "were infected with this poisonous attitude by Mr. Brewer, and they aided and assisted him."

Bason said the department, led by Brewer, improperly claimed that enhanced versions of Promis, developed by Inslaw outside the government, belonged to the department and could be used and distributed any way the department desired.

The judge ruled that while the original version of Promis was in the public domain because it had been developed for the government, later versions belonged to the company. "No matter how minor an enhancement to Promis might be, this court is of the view that the enhancements are subject to trade protection," Bason said.

As a result, he said, the Department of Justice's use of the enhanced software in 45 U.S. attorneys' offices beyond the 20 specified in the original contract violated Inslaw's rights.

Bason likened Inslaw's decision to let the department use the advanced version of the software on a trial basis to an automobile dealer allowing a customer to use a high-quality loaner car while waiting for delivery of another model. "So the customer drives off with the car and the dealer never hears from him again," the judge said. "I really think that's what the Department of Justice has done in this case."

"The Department of Justice took, converted, stole Inslaw's enhanced Promis by trickery, fraud and deceit," the judge ruled. "It would have amounted to corporate suicide for Inslaw to have allowed the Department of Justice to have unlimited rights to those enhancements."

Bason said the government failed to negotiate in good faith with the company about a settlement of the dispute and "engaged in an outrageous, deceitful, fraudulent game of cat and mouse demonstrating contempt for the law and any principle of fair dealing.