The federal bribery conspiracy case against retired Maryland Congressman Edward A. Garmaltz was thrownout of court today at the urging of Justice Department officials who said they had discovered that their key witness had lied to a grand jury and forged documents.

Garmatz was freed of all charges by U.S. District Judge Alexander Harvey II, who accepted the statement of Deputy Assistant Attorney General Russell T. Baker Jr. that the government's case lacked "integrity."

The 74-year-old Democrat, who had retired in 1972 after 13 terms in Congress, wept and clasped the hand of his attorney, Arnold M. Weiner, on hearing the decision. Garmatz credited Weiner with unearthing most of the new evidence that freed him.

For one month, according to the Justice Department, Weiner and federal prosecutors had separately investigated the testimony of United States Lines president Edward J. Heine, the principal witness for the prosecution. They began comparing notes in late December. Interviews with Heine, whose company is one of the larger shipping firms, coupled with a chemical analysis of Heine's handwritten documents by Weiner's staff led them to the conclusion that the shipping magnate and former friend of Garmatz had lied.

Weiner said today that Heiner's motives were obvious. By becoming a government witness, Heine had won immunity from prosecution on charges that his firm allegedly maintained a million-dollar slush fund in Europe that was used to make illegal kickbacks designed to gain business.

"It was a hell of a thing to go through for one whole year," Garmatz said after today's hearing. He had stopped outside the federal courthouse named after him, wiped the snow off the sign and declared that the Garmatz federal courthouse had survived.

Garmatz was indicted in September 1977, more than one year after Heine was told he was under serious investigation. In a manuever known as "trading up," Heine exchanged his testimony against Garmatz together with documents implicating the retired congressman for permanent immunity against prosecution of the slush-fund charges.

Heine claimed that Garmatz accepted a $4,000 payment from shipping companies hoping to influence 1971 legislation that eventually earned them handsome profits. Garmatz also was charged in the indictment with accepting indirectly some $11,000 more, but the aide suspected of being the funnel for the alleged larger bribe died in 1974.

That left Heine as the principal witnesses, and in August, 1976, he produced the first of the documents - later found to be tampered with - that led to the indictment.

Saying that he now regretted the indictment against Garmatz, Deputy Assistant Attorney General Baker explained that the government "did not have a case" without Heine.

"We would have never gone ahead with that on itself," Baker said of the remaining evidence against Garmatz.

Judge Harvy asked Baker in court why the federal prosecutors did not discover earlier that Heine was a suspect witness. Baker replied that he felt that Assistant U.S. Attorneys Frank Rozzano and William Maderer from New Jersey had investigated the case in "a highly professional and thorough manner."

But when pressed after the court session, Baker said he could not comment on what led the prosecutors to became suspicious of Heine's testimony or what new evidence they had unveiled.

Weiner, however, could barely stop talking during his hour-long new conference.

After thanking Baker, he recited what he saw as the lessons to be learned: Don't judge politicians accused of crimes so easily. And beware of "random accusations of desperate men . . . men in trouble who level accusations against others to save their own skin."

Then he detailed the tedious yet dazzling research he and his staff oversaw that he said led to Garmatz' dismissal.

Not until Septmeber, Weiner said, were the defense attorneys allowed to enter the building where the presecution's evidence against Garmatz was stored.

"We walked into this large room . . . picked through it and limited ourselves to a select group of 20,000 to 30,000 documents," Weiner said.

Before he began his story, however, Weiner reminded the press that such an investigation, involving expert document analysis too, costs dearly. Weiner said that as a result his client was in need of funds and that Garmatz may file a civil suit against Heine to recover the costs of the investigation.

Even though Heine is permanently immune from the slush-fund related charges, his actions will be investigated for possible "obstruction of justice" because of his alleged forgery of documents and his alleged "misrepresentation of facts" before the grand jury, according to Baker.

Weiner said his staff soon realized that the case against Garmatz rested on Heine. So they looked into Heine and - Weiner claimed - found a witness who could testify that Heine "spent a week dreaming up accusations against others to get off the hook."

This witness, Weiner said, would have testified that Heine realized he had to get himself out of "the mess" and was told he could "get out of his trouble by trading for someone bigger."

After one week of this alleged "dreaming," Weiner said, the witness was told by Heine that he had "something to sell" to the government: the allegation that a $4,000 bride was paid to Garmatz.

When Heine's attorneys heard his story, Weiner said, they advised the shipper that he needed documentation. So, where he could, Heine altered pages from his diaries covering a three-year period and rewrote three entire volumes, Weiner said.

Heine's attorney, Theodore Geiser, refused to comment on most of Weiner's assertions or those of the federal prosecutors because his client is under investigation. He did say, though, that the jury should have decided the credibility of witnesses, not the government.

"I offer my sincerest compliments to Arnold Weiner, who was able to get the acquittal without the trial. That is the high point of our profession," Geiser said.

The unraveling of these allegedly forged diary pages was a mentally numbing experience, Weiner said, for first they had to pinpoint the suspicious entries and check them with other witnesses.

"Most of the activities and appointments concerned Robert J. McElroy - the aide who died in 1974," Weiner said. "The congressman himself had been long retired and could not focus his attention well on these events."

So they combed for other witnesses and sometimes found them, Weiner said. "Whenever we went to these third persons they contradicted Mr. Heine," he commented.

As doubt was cast on Heine's testimony, Weiner said, he made the decision to call in expensive experts to run chemical analyses of the diaries.

Former FBI agent Curtis Thompson, a documents expert, by correlating the impressions left on one page with words written on a preceding page, discovered that pages had been removed from the diary. Weiner said. Thompson found that the impressions on some pages did not match the words written on the immediately preceding ones, the attorney said.

Weiner said the findings were tantalizing enough to warrant a more sophisticated analysis, so he hired Lyndal Shaneyfelt, another former FBI documents expert. On Dec. 19 the two former agents set up a "strange-looking" laboratory in Baltimore, replete with red lights and foul chemicals, and aroused the attention of the prosecutors.

The next day, Dec. 20, the prosecutors confronted Heine with the news that "two men in Baltimore are going over your records with scientific methods," Weiner said. Apparently Heine made a statement that day as to whether he had made any alternations.

The next day Heine allegedly told his attorney about the three diary volumes he had rewritten and that he still had the originals. Coincidentally, Weiner said, he had filed a request asking Judge Harvey to order Heine to turn over all his diaries and documents covering the three-year period, not knowing that the originals still existed. Since Heine's attorney knew the originals for the volumes existed, Heine had no choice but to turn them over.

Finally, Weiner described his favourite piece of detective work in the investigation. The retirement dinner thrown on Sept. 20, 1972, for Rep. Garmatz was a major event in the alleged bribery conspiracy. Heine had testified to the grand jury, Weiner told reporters, that he and his colleague had been accosted there by McElroy, who demanded money.

"Heine described in graphic detail what this dead man (McElroy) had done to them. But it was a fabricated story. They thought they could rely on McElroy attending (Garmatz' retirement) dinner."

In fact, Weiner discovered through funeral parlor records, McElroy had been at his brother's funeral and had dined that night with Herbert R. O'Connor Jr., the sone of Maryland's former senator and "a man of unquestioned integrity," Weiner said.

The final struggle, in Weiner's narrative, was with the prosecutors who he claimed were reluctant to dismiss the charges.

U.S. Attorney Robert J. DelTufo of New Jersey disagreed, in part, with the impression left by Weiner's account.

"These two young prosecutors were the original driving force to re-evaluate the witness (Heine) and as they went down the trail they were aided by Mr. Weiner," DelTufo said.

Like Baker, DelTufo declined to explain exactly how they investigated Heine and what they came up with.

Everyone at court, though, appeared pleased. Baker was praised repeatedly by all attorneys for his courage in dropping the charges against Garmatz.

Weiner said the "whole federal prosecution process was drawn into question by this case. The decision to dismiss saved it . . . It is times like this that breath life into the motto at the Justice Department: The United States wins when justice is done."