The scramble is on in the Maryland legislature. Not the kind of election scrambling usually associated with politicians: For most of the legislators, that ended Sept. 14 with the Democratic primary. In a state where registered Democrats outnumber registered Republicans 3-to-1, winning the primary usually means one is elected.

It also means that maneuvering can begin for the leadership of the General Assembly. And that can bring about serious scrambling.

Most of the attention has focused on the Senate, where incumbent President James Clark Jr. (D-Howard) and Finance Committee Chairman Melvin A. Steinberg (D-Baltimore County) have been wheeling and dealing for months, trying to get enough Democratic votes to be elected.

The consensus is that Steinberg has the votes to unseat Clark, but as he himself admits, "you have to worry about people chipping away at you."

The incumbent speaker of the House of Delegates, Benjamin L. Cardin of Baltimore, has no such headaches. He will be reelected, probably without formal opposition. But Cardin does have difficult decisions to make in terms of his leadership, decisions that are important to him for two reasons.

First, they will affect the way the House runs the next four years and second, his handling of these situations will be watched closely as an early test of his leadership as he prepares to run for governor four years from now.

Cardin's problems begin with the Environmental Matters Committee. Its chairman for the last four years was Torrey C. Brown (D-Baltimore). But Brown was beaten in the primary, and his vice chairman, Irwin Hoffman (D-Washington), is retiring. Another logical choice as Brown's successor would have been Del. Kay G. Bienen (D-Prince George's), but she ran for the Senate and lost by 22 votes.

Thus, Cardin may pick someone outside of the committee for chairman. One possibility is Tyras S. Athey (D-Anne Arundel), chairman of the Ways and Means Committee for four years. Athey served on Environmental Matters earlier in his career. He is regarded as a quiet, steady hand, just the kind of leader the committee, often chaotic under Brown, may need.

If that happens, the logical successor to Athey on Ways and Means is vice chairman Gerard F. Devlin (D-Prince George's). But whether Devlin gets the job depends on yet another committee, Economic Matters.

There, Cardin is under considerable pressure to remove Del. Frederick C. Rummage (D-Prince George's) as chairman. Rummage has been linked closely with the state's banking interests during his tenure as chairman and suffered considerable embarrassment when, while on the House floor pushing a controversial bill that raised interest rate ceilings in the state, he was discovered to have an open phone line from the chamber to his committee room. In the room was William K. Weaver, chief banking lobbyist in the state.

Cardin could make Rummage the speaker pro-tem, a position vacant because of the retirement of Del. Daniel J. Minnick Jr. (D-Baltimore County). That would leave the Prince George's delegation without a chairman, unless Devlin is given Ways and Means.

If Devlin is picked for Ways and Means and Athey for Environmental Matters, the way would be cleared for Cardin to give Economic Matters to a Baltimore delegate.

In all likelihood, that would be Del. Dennis C. McCoy, chairman of the city's delegation, or Del. Larry Young, a rising power in Baltimore. Cardin may want to give Young the chairmanship because 13 of the city's 27 delegates are black and none of the House's chairmen are black.

The bottom line for Cardin is this: He must have at least one chairman from Prince George's and one from Baltimore. He also would face considerable criticism if he did not remove Rummage.

In the Senate, the situation is far more muddled because of the fight for the presidency. If Steinberg wins, the entire leadership will be new in January.

Under Steinberg's current plan, Sen. Thomas V. Mike Miller (D-Prince George's) would succeed Sen. Rosalie S. Abrams (D-Baltimore) as majority leader; Sen. Clarence Blount (D-Baltimore) would replace Sen. Laurence Levitan (D-Montgomery) as chairman of the Budget and Taxation Committee; and Sen. Jerome F. Connell would replace the departed Harry J. McGuirk as head of Economic Affairs.

If Clark finds a way to chip away at Steinberg's base and is reelected, Steinberg probably will lose his chairmanship to Sen. Julian L. Lapides (D-Baltimore), one of three Clark votes in the city delegation.

That delegation, after a meeting last week with Mayor William Donald Schaefer, voted 6 to 3 in favor of Steinberg as president. With Miller prepared to deliver seven votes from Prince George's and Steinberg getting at least six from Baltimore County, that puts the feisty labor lawyer very close to having the votes he needs.

Steinberg also appears to have at least two votes from Anne Arundel and another from Montgomery to give him a minimum of 22 votes, more than enough to carry the Democratic caucus, which will have no more than 42 of the Senate's 47 members and could have less depending on November's elections.

Clearly, the scrambling is not over. A number of delegates have scheduled meetings with Cardin to make their pitch for leadership positions. Others, especially incoming freshmen, will meet with him to plead for committee assignements. Cardin, who prides himself on not making deals, has ordered his chairmen not to discuss leadership or committee appointments with anyone.

But there will be at least one change in policy. Unlike 1979, when 18 freshmen were put on one committee, Constitution and Administrative Law, this year's freshmen will be spread out. That means they will be fighting for the more prestigious committees instead of resigning themselves to the dumping freshmen usually expect.

In the Senate, Clark and Steinberg will continue nonstop calls and meetings until the caucus votes in December. Clark is still hoping that if the caucus vote is close enough, the Republican minority could come through for him when the vote goes to the floor. But with the defeat of minority leader Edward J. Mason (R-Allegany), it will be difficult for Clark to get all the Republican votes.

If Steinberg wins, the Senate will be a very different place. With about 15 new senators, new committee chairmen and the wise-cracking labor lawyer replacing a laid-back Howard County farmer as president, it may be barely recognizable when the gavel first falls in January.