Sen. Thomas V. Mike Miller walked into his office here on Tuesday afternoon, picked up his phone messages and smiled. The top message, from someone with solid connections in labor, said: "Spoke with friend today and he guarantees Frank Shore will be with us."

"That makes 22," Miller said.

Numbers are the rage here these days, especially ones that add up to 41 -- the number of state senators who will be in the Democratic caucus in the 1983 General Assembly. On Dec. 6, those 41 people will decide one of the more bitterly contested elections in Maryland this year: president of the state senate.

Miller, head of the seven-member Prince George's senate delegation, has worked since last summer to help elect Melvin A. Steinberg of Baltimore County as the successor to incumbent James Clark Jr.of Howard County.

Steinberg, an aggressive labor lawyer with strong labor backing, began actively campaigning for the job at the end of last session and appeared to have it wrapped up shortly after the Democratic primary. But Clark, whose laid-back, country-farmer style often makes people forget he still has the instincts of the fighter pilot he once was, has clawed back. Backed by rural and banking interests, he has been working so effectively in fact that some people here now think he will edge Steinberg out when the caucus meets on Dec. 6.

That was why the phone message excited Miller. For the past 10 days, each side has been claiming to have exactly the 21 votes needed for election. Each concedes having several, "soft votes." This week Steinberg's friends in labor have become involved calling senators like Shore from Montgomery County to let them know a vote for Steinberg would be much appreciated.

"I've had some calls," Shore said. "But as far as I'm concerned the Montgomery delegation made a commitment to vote as a bloc and I'm still planning to do that."

"It's really wild, the whole thing is completely out of hand," said Sen. Laurence Levitan from Montgomery whose chairmanship of the budget and tax committee appeared in jepoardy early in the Clark-Steinberg duel. "If anyone ever took an on-the-record poll the vote would probably be 1-1 with 39 undecided. I think it's going right down to the wire."

The senate donnybrook is being watched in part because of what it might say about the re-emerging influence of labor in state politics. Also, political observers expect Steinberg would challenge House speaker Benjamin L. Cardin on a number of issues, re-asserting the Senate leadership that some say has waned over the last four years.

But the struggle in the senate is only one of several soap operas that have been unraveling since election day. On the House of Delegates side, Speaker Cardin has been under siege fighting off veteran legislators who are vying for leadership positions.

"I'm just sitting here throwing darts at a dartboard trying to decide who to appoint to leadership positions," Cardin said last week. Actually, Cardin has a complicated chart on his desk listing all the candidates for leadership position. The chart also includes percentages based on geography, gender and race because Cardin insists on having a "balanced" leadership.

Two of the six house chairmanships are vacant as the result of the elections and several second-level leadership spots also must be filled. The most interesting scramble is for the leadership of the appropriations committee. John Hargreaves, who ran the committee since it was first established in 1970 to handle the state's annual budget, was defeated in his reelection bid and since then the line of those wanting to succeed him has formed outside Cardin's office.

Among those who would like the job are Dels. R. Clayton Mitchell Jr. of Kent, Tyras S. Athey of Anne Arundel, John Douglas of Baltimore, R. Charles Avara of Baltimore, who is the current vice chairman, and Paul E. Weisengoff of Baltimore, Cardin's closest friend in the House.

Speculation this week centered on Mitchell, whose appointment would infuriate labor, which worked hard to oust Hargreaves, Mitchell's mentor. But Cardin may solve that problem by moving most labor-related bills, including a collective bargaining package, into Athey's ways and means committee.

"There is definitely a chance that we'll move labor bills into ways and means," Cardin said. "I was thinking about doing that anyway because several members of appropriations have commented to me that they might belong there anyway."

Weisengoff spent part of Tuesday in Cardin's outer office, insisting he was serious about wanting the job. "I invited Ben to lunch," Weisengoff joked, "and he said he didn't want to be seen with me. I said, 'I don't blame you.' "

A Weisengoff appointment would be considered disastrous by Gov. Harry Hughes and his staff because their relationship with Weisengoff is frosty at best. Weisengoff ran Sen. Harry J. McGuirk's challenge to Hughes in the Democratic primary and listed Republican Robert A. Pascal at the top of his sample ballot in the general election.

For that reason, along with the fact that Weisengoff is valuable to Cardin as his unofficial majority leader, he is unlikely to get the job. Giving Athey, the current chairman of ways and means, the job would create another vacancy and more headaches for Cardin. So Mitchell is the betting favorite.

The other vacancy is the chairmanship of environmental matters. Dels. Larry Young and Dennis C. McCoy, both of Baltimore, and Paula C. Hollinger and Thomas B. Kernan of Baltimore County, would all like the job but Young is the frontrunner. His appointment would give Cardin a black chairman, important, especially, since 13 of the 27 members of the new city delegation are black. Young will get a vice chairmanship at the very least.

Cardin also must deal with committee appointments. He is expected to solve one problem for a local delegation by appointing Del. Lorraine Sheehan to a secondary leadership role, probably as assistant majority leader. That move would avert a fight next Tuesday between Sheehan and Del. Charles J. Ryan for the chairmanship of the Prince George's delegation.

The house maneuvering centers around Cardin, who holds the cards and always plays them close to the vest. But in the senate, the fight for the presidency involves everyone.

Steinberg and Miller, caught off guard when Clark refused to cave in after the primary, have scrambled desperately this month. For example, they promised McGuirk, who remains influential within the Baltimore delegation even though he is no longer in the legislature, that his secretary would become the senate president's secretary. They promised Sen. Joseph J. Long Sr. of Worcester that they would retain his Eastern Shore ally, Sen. Frederick C. Malkus of Dorchester, as president pro-tem even though Malkus is a Clark supporter.

Right now, each side claims 22 votes, three more than exist. The seven Prince George's votes are solidly with Steinberg, although there have been rumors that Tommie Broadwater Jr., the only black member of the delegation, might switch sides if the other four members of the black caucus urge him to do so. But the caucus is as split as the rest of the senate and Broadwater has repeatedly told Miller his vote is solid.

The five Democrats in the Montgomery delegation are with Clark. But Shore's support is considered soft because of labor pressure, and Levitan has repeatedly asked the Baltimore delegation, currently split 5-4 for Clark, for a meeting to discuss voting together for either candidate.

Steinberg and Clark, who were more than willing to talk publicly earlier, have pulled back, preferring to let their supporters talk for them. "I've learned my lesson," Steinberg said. "I was honest with people early about where my commitments were. Everytime I named a name and it appeared in the paper Jim Clark called them and made a counteroffer. Now, I'm keeping quiet."