A Montgomery County judge denied bail yesterday to Edward Thomas Mann, the former IBM employe accused of shooting two men to death and wounding seven others during a 7 1/2-hour siege of an IBM office building in Bethesda last Friday.

District Court Judge Stanley Klavan ruled in a brief hearing in a tiny courtroom next to the county jail that setting a bond would be inappropriate since two persons had been killed "and there are grave possibilities that there could be more" deaths.

Klavan scheduled a preliminary hearing on June 25 for Mann, a 38-year-old Mitchellville resident who worked for 13 years at IBM as an advisory marketing representative. Mann faces two murder counts and 12 counts of assault with intent to commit murder. Evidence against him could be presented to a Montgomery County grand jury as early as tomorrow, although assistant state's attorney Roger Galvin said no decision has been made on whether to do so.

Mann, dressed in green slacks and a blue shirt, said nothing during the hearing. His attorney, R. Kenneth Mundy, a prominent Washington defense lawyer, argued that a reasonable bond should be set because Mann has no previous criminal record, has strong family ties and has been a lifelong resident of the Washington area.

"He did surrender himself to police after conferring with his wife," Mundy said, "and there are indications that Mann sought to surrender himself as early as 11:15 a.m.," 15 minutes after Mann rammed his copper-colored Lincoln Continental through glass doors at the building, off Democracy Boulevard near Montgomery Mall, and then fired the first of about 150 gunshots he sprayed throughout the three-story structure.

Galvin did not dispute Mundy's remarks, but later said, "It was our office's, and the judge's position, that the danger to the community was so great" that Mann should be held in jail.

Mann is being held alone in a cell at the Detention Center on Seven Locks Road while undergoing orientation, Warden Sam Sexton said. The warden said it is unlikely that Mann would be placed in the general inmate population.

Mann's wife, Rosa, and a daughter sat pensively during the court hearing, but declined comment afterward.

Mundy has represented clients in several well-known criminal cases in recent years, with perhaps the most notable being 16-year-old Terrence G. Johnson, who was accused of murdering two Prince George's County police officers in 1978. Johnson was eventually convicted of manslaughter and illegal use of a handgun in one policeman's death and was found not guilty by reason of insanity in the other slaying.

Mundy said that Mann asked for him by name last Friday night and that he met with him twice over the Memorial Day weekend for a total of about an hour. Mundy offered no hint as to how his client might plead. The defense lawyer said Mann may have made some statements to the police before hiring him.

After the court hearing, another former IBM employe, Edell Lydia Jr., who, like Mann, is black, charged that the firm is "responsible for all the deaths and injuries" last Friday. Lydia, who said he won a "five-figure" discrimination damage award against IBM in 1975, alleged that the shooting rampage was the product of what he said was IBM's "insidious, vile, racist policies" toward blacks.

Mann had filed a discrimination suit against IBM in 1977, but the D.C. Human Rights Commission dismissed it for "no probable cause."

An IBM spokesman confirmed that Lydia had won a damage claim against the company, but said, "We take every possible means to insure that our managers do not discriminate in hiring or promotions, all of which are based on merit."

Meanwhile, Montgomery police sources said that the automatic weapon allegedly used by Mann during the siege, and recovered by police when he surrendered, was an Uzi submachine gun, a lightweight but powerful weapon used by the Israeli armed forces. Police also recovered three other weapons from the third-floor office where Mann gave himself up--a shotgun, a .357 magnum pistol and a .25-caliber automatic handgun.

Five men who were shot and a sixth who suffered a heart attack at the IBM office building remained at Suburban Hospital in Bethesda last night. Five were listed in good or stable condition, according to a hospital representative. But the sixth, Jessie Roberts Lewis, 69, a Burns International Security guard who worked at the building, was listed in very critical condition with a gunshot wound in his neck.

IBM said that business was conducted as usual yesterday after work crews made repairs throughout the building during the weekend. The company also announced that it is paying for the funeral expenses for the two men killed during the siege, Hung Phi Nguyen, 40, of Silver Spring, and Larry Lewis Thompson, 56, of Vienna.