Montgomery County Executive Charles Gilchrist and Baltimore Mayor William Donald Schaefer, whose shouting match here last month signaled the breakup of the legislature's most successful, if unlikely, alliance, declared an uneasy truce here today.

After a brief meeting at the State House, the two chief executives issued a conciliatory statement in which they pledged "an increased effort on the part of ourselves and our state delegations to emphasize areas of agreement and to resolve areas of disagreement as they arise."

But despite today's appearance of harmony, the two chief executives and their legislative delegations have, in the last few weeks of skirmishing, managed to lay the groundwork for an inevitable battle over a potentially sweeping redistribution of wealth between the state's richest suburban jurisdiction and its poor big city.

"We've agreed to settle it their differences two years hence," Gilchrist said as he and Schaefer emerged, all smiles, from the private, 15-minute meeting. The last time Gilchrist and Schaefer were together here, last month at the Annapolis Yacht Club, they engaged in a shouting match.

Gilchrist acknowledged that differences remain between them, and that today's easing of tensions is just the precursor to a larger battle ahead. During the last two months, both sides managed to open some old tensions and stir up long-running regional antagonisms among the folks back home.

The way was cleared for the truce because both sides were able to put on the table for the 1984 General Assembly session a wide-ranging agenda of state-aid formulas used to distribute everything from education funds to highway repair money.

Legislators on both sides agree that this public quarrel between longtime voting allies raises the specter of a historic shift in traditional alliances in Maryland's political arena, with Montgomery eventually turning to form a new voting coalition with the wealthier, like-minded suburban counties circling Baltimore.

"It used to be Baltimore, Montgomery and Prince George's forming alliances," said Del. Mary Boergers (D-Montgomery). "Now Montgomery County is much more like Howard County and Baltimore County."

The eruption of hostilities began two years ago when Baltimore and three rural counties sued in court to overturn the state's school-funding formula. They charged that the formula was unfairly weighted toward wealthy Montgomery, which was also able to subsidize locally. Last year, the Circuit Court agreed, and that landmark decision is pending appeal before the appeals court.

"Montgomery stands to lose $30-to-$50 million in state aid" if the decision is upheld, according to Sen. Victor L. Crawford (D-Montgomery). "The educational system as we now know it will be ruined."

"We are very concerned about education," Gilchrist said. "Education has been the cornerstone of our whole attitude towards government."

In "retaliation"--a word Gilchrist shuns--the county wanted all of the state aid funding formulas on the table as bargaining chips in the event that the suit is upheld and the school-aid formula has to be renegotiated.

If the school case is decided next year, as expected, the 1984 assembly will have to deal with a new formula. Montgomery senators sponsored bills that require rexamined in that same year the current police and transportation aid formulas--now weighted toward Baltimore.

But while sparked by Baltimore's school suit, the current split in the alliance is really the result of basic differences in priorities of suburban Montgomery and urban Baltimore, which until recently were glossed over for the sake of preserving an alliance that produced a raft of liberal legislation.

Consultant Henry Bain, a former University of Maryland policy science professor and an expert on Maryland political history, said the alliance began in the mid-1960s, with the election of a liberal Democratic (Montgomery) delegation to the General Assembly and the election of a liberal Democratic majority to the County Council.

Montgomery's well-heeled liberals and Baltimore's big-city-machine Democrats then found natural common ground on the traditional liberal agenda--Montgomery out of altruism, Baltimore out of sheer necessity of saving a city being pulverized by urban problems overtaking cities nationwide.

"The Montgomery countians were interested in statewide legislation that was liberal in nature, whereas the Baltimore city delegation was interested in the urgent needs that they had," Bain said. "It was a coming together of two complimentary programs."

But marriages born of convenience die easily, with no love lost. "We have never been really married," said Del. Paul E. Weisengoff (D-Baltimore). "We may have just been living together."

But desite the cozy accommodation, the strains on the partnership were there from the beginning, always running deeper than the areas of common agreement, as blue-collar Baltimore City and "Perrier and Brie" Montgomery County are radically different worlds.

Politicians and State House watchers are speculating on a variety of reasons why the alliance is cracking now. Some say it was unnatural to begin with. Others point to election-year politics and say the current rhetoric is aimed primarily for back-home consumption. Still others say that Montgomery is responding to intense economic pressure--including federal lay-offs--that historically have driven a wedge between the haves and the have-nots in a scramble for diminishing fiscal resources.

"During good times, when we had a little extra to share, we could share it easily," Del. Boergers said. "But our county is getting hit hard because we have more of the federal workers. We can't afford to be so generous with the rest of the state with our dollars."

Baltimore Del. Frank C. Robey Jr. agreed with that analysis, but reached a different conclusion. "It reminds me of the old let-them-eat-cake philosophy during the French revolution," he said. "Only we're starving. It's clearly a case of the haves versus the have-nots. The federal cutbacks are coming and the haves want to hold on to what they have."

Del. Luiz Simmons (R-Montgomery), blames the county's Democratic leaders for "capitulating" to Baltimore to curry favor with the state's political leadership. In what sounded like a potential 1982 campaign theme, Simmons said, "Any Montgomery County delegate who wants to go statewide knows he has to acquiesce to Baltimore City . . . . The county leadership has been co-opted into the Baltimore City juggernaut."

But some Montgomery House delegates said that in the game of power politics, accommodation is the key for Montgomery's survival. "We have 19 votes," said Del. Lucille Maurer (D-Montgomery). "We can't afford to be isolated down here." She added, "But I get skewered for that back home.