Maryland Lt. Gov. Samuel W. Bogley III, dumped from Gov. Harry Hughes' reelection ticket, announced tonight he will run for the same office again--as the running mate of Hughes' Democratic primary opponent, Baltimore state Sen. Harry J. McGuirk.

The unlikely alliance of McGuirk, the essence of Baltimore club politics, and Bogley, the quixotic loner who often appeared lost in the Annapolis scene, was agreed to at a private meeting last night and formally revealed at a Democratic club function attended by the two men here in Anne Arundel County tonight.

As 60 members of the Stoney Creek Democratic Club and members of Bogley's family watched, McGuirk officially offered a spot on his long-shot ticket to Bogley and and the soft-spoken Bogley quickly replied, "Thank you very much. I accept.

"It is with great pride but humility that I join someone who has proven his leadership," Bogley said of McGuirk, the state Senate veteran and powerful committee chairman. "Here are two people who are going to get this state moving."

Tonight's announcement of the McGuirk-Bogley ticket--at the same Democratic club where Bogley made his first appearance as Hughes' running mate in 1978--appears to indicate that McGuirk is in the governor's race to stay. McGuirk has been considered a long shot to win the Sept. 14 Democratic primary and many associates felt he would eventually reconsider the race and run instead for reelection to the Senate.

"There's been a lot of speculation about the candidacy of Harry J. McGuirk for governor," McGuirk said. "I've tried to convince the people I'm serious about the race and I've known for a number of weeks that when I announced my choice for lieutenant governor it would help convince people I was serious about this race. My choice is Sam Bogley."

For Bogley, the decision to join forces with McGuirk against Hughes ended months of public agonizing over his political future. It also ended a frustrating and often-embarrassing experience as Hughes' lieutenant governor. Almost immediately after the Hughes-Bogley ticket was elected in 1978, the two men publicly parted over Bogley's strong antiabortion views and Bogley has been given little to do since.

This was a point that McGuirk and Bogley repeatedly returned to tonight as they joined hands and raised them in the traditional victory sign and pledged that their administration would be a true partnership. "In these days a governor has got to be able to respond quickly, he's got to be able to think on his feet," Bogley said. "You can't just have one person trying to make all the decisions. The governor just can't do it by himself."

Bogley played down his difference of opinion with McGuirk on the abortion issue. Although McGuirk says he is not as pro choice on the issue as Hughes, he said tonight he will not tamper with state funding for Medicaid-funded abortions.

Bogley said that as lieutenant governor under Hughes he is now in position to "show voters the difference between the governor and Sen. McGuirk."

Bogley took one direct swipe at Hughes, saying he chose not to remain with the Hughes administration because he was dissatisfied. "It was I who in 1981 saw no reason for there to be a Hughes-Bogley ticket in 1982. I have been portrayed as being dumped by Hughes, but I was the one who, after two years of working to try to make the marriage work, decided that only an annulment could resolve the situation."

Bogley said he did not personally tell Hughes that he would be joining his opponent's ticket tonight but told an aide, John Griffin, and asked Griffin to inform Hughes of the impending McGuirk-Bogley alliance.

McGuirk and Bogley emphasized tonight that their alliance, with the gubernatorial candidate from Baltimore and his running mate from Prince George's County, was more geographically balanced than the Hughes ticket, with both Hughes and his lieutenant governor candidate, state Sen. Joseph J. Curran Jr., from Baltimore.