Former Rep. Robert E. Bauman, once the rising star of the Republican right, today withdrew from the race to recapture the 1st Congressional District seat he lost in 1980 after admitting to problems of homosexuality and alcoholism.

Bauman said his decison was spurred by "virulent and scurrilous personal attacks" mounted by top aides of his GOP primary opponent, former Maryland state senator C.A. Porter Hopkins.

The surprise announcement ended a bitter, neck-and-neck battle between the two conservatives seeking the nomination in the sprawling district where Bauman was once so popular that no one bothered to challenge him in four primaries. It also heads off the possibility of a rematch between Bauman and Democrat Rep. Roy Dyson, the young state legislator who captured the seat by a narrow margin in 1980 after the disclosures of Bauman's troubled personal life.

Bauman bowed out of politics today with the same show of bravado and invective that had marked his seven-year career in the U.S House of Representatives. Asserting that he could win the Sept. 14 primary and was the "best" candidate to face Dyson in November, Bauman nevertheless said he was "out of politics" for good.

"I no longer have what the politicians call the fire in the belly. I am today withdrawing from the race," he told the standing-room-only crowd at the Tidewater Inn here. "I do so mainly because I'm tired, tired of the requirements public life imposes on a person, tired of the kind of tactics that have come from the other side."

An hour after Bauman's announcement, at an impromptu press conference on the sidewalk in front of the Tidewater Inn, Hopkins branded Bauman's allegations against his campaign "ridiculous."

"We are not ashamed nor are we upset about anything that has gone on in the campaign, " Hopkins said. He added that he was not surprised by Bauman's withdrawal because he said his own campaign is "picking up support. That's the real reason for his getting out.

"I am delighted he has withdrawn because now I don't feel I have to worry about going into a fight with my hands tied behind my back," Hopkins said, adding that he had promised not to bring up Bauman's "personal problems" and had stuck to that vow.

Bauman has not been able to escape the specter of his personal problems since Oct. 3, 1980, when he entered a Washington courtroom and agreed to undergo rehabilitation rather than face trial on a charge that he solicited sex from a teen-aged boy. Days later, at an emotional press conference here at the Tidewater Inn, he admitted to the "twin compulsions" of alcoholism and "homosexual tendencies" but announced he would stay in the race. On Nov. 4, he lost the election by four percentage points.

Last November, a slimmer, calmer, but still feisty Bauman announced that his personal problems were "over and done with" and that he would seek to reclaim his House seat. Though some longtime supporters joined the 1982 campaign, others, saying they no longer felt Bauman was electable, began to seek an alternative candidate. In January, Hopkins, a wealthy gentleman farmer here on the Eastern Shore, plunged into the race, and recently his efforts have been gathering momentum.

Today, after Bauman's announcement, Maryland Republican Party chairman Allan Levey said, "The problems that Bob (Bauman) had were just one of the things (that led to his decision). Porter was gaining a lot of momentum and people were taking him more seriously. The primary was going to be very close."

Staunch Bauman supporters, such as Kitty Martines, from Cecil County at the northern tip of the sprawling First District, lamented Bauman's decision. She and other campaign workers were called here Wednesday night to a meeting a Bauman's historic, prim farm house on the outskirts of town, where Bauman told them privately that he was withdrawing. "We're losing a fine statesman, someone who could really help us," Martines said today. "But it's his decision . . . and for him personally, I think it's best."

Dyson, who was transformed from underdog candidate to victor by the Bauman disclosures, said today that as a politician, "My heart goes out to him. He is a political animal. He worked his whole life for something. To know it's over must be agonizing."

But the Bauman who walked jauntily into an ornate reception room here did not appear to be a man in agony. Before making his formal statement, he bantered with reporters and tossed off a few of the sarcastic barbs that made him a favorite of the press during his years on Capitol Hill.

He opened his press conference by announcing that his voter support, staff organization and campaign warchest far surpassed those of his opponents. "Our campaign has defied all the skeptics," he said.

Then Bauman launched into an attack on Hopkins' lieutenants, asserting that they had threatened to use revelations about his personal life in the campaign if he did not pull out of the primary before the July 16 withdrawal deadline. Bauman said he planned to take his allegations to "the appropriate federal and Maryland authorities for whatever disposition they decide to make."

Jack Shaw, a former Bauman finance chairman who now is Hopkins' finance chairman--and one of those Bauman accused of trying to intimidate him--said Bauman's parting shots today were reminiscent of Richard Nixon's press conference after losing the California governship contest in 1962. "The gist of it all was, 'You won't have Bob Bauman to kick around any more.'" Shaw said.

But unlike Nixon, Bauman answered questions politely and often with friendly gibes. Bauman said the current scandal on Capitol Hill involving pages was not a "determinate" in his decision. Asked if he was under investigation by any federal or state authorities, he said, "No, but I don't have to answer that any more. I'm a private citizen."

Bauman, 45, said he was looking forward to reading books, practicing law in Easton and spending time with his children. Since the disclosures in 1980, he and his wife, Carol, have separated and are seeking a divorce.

Despite his decision, Bauman's name will appear on the primary ballot because he missed the July 16 withdrawal deadline. "I intend to vote for myself," Bauman said. "I think I'm the best candidate."

"Along with the tan tie, the blue shirt and color-coordinated suit," Bauman said, describing his dapper outfit, "let the record show that Bob Bauman wasn't downcast. He felt great. He's not under any coercion, except perhaps the coercion of logic and good sense."