Hamilton Jordan bursts out of the VIP trailer, his face flushed, his shirt showing perspiration and dashes across a makeshift courtyard, through the Boiler Room trailer and into the Situation Room trailer.

"I've got Muskie on the phone," he calls to Tom Donilon, the president's 24-year-old wunderkind of political math. "He'll take care of it."

Donilon, commander of the Carter Situation Room, instructs his boss on how the deed is to be done.

Maine Gov. Joseph Brennan was trying to cut a pro-Kennedy deal in his delegation: to get his delegates to endorse Edmund S. Muskie of Maine, Carter's secretary of state, for president and then to have his state vote unanimously to defeat the Carter-backed rule that would bind delegates for the first ballot.

Just moments before the vote, Donilon picked up word of the deal through his operatives in the convention hall. He alerted Jordan, who had the White House operators hastily located Muskie. At Donilon's suggestion the secretary of state agreed to call the Maine delegation on the floor of the convention hall and quash the Brennan effort.

Minutes later, the roll call was under way on this, the crucial vote of the convention.When it came to Maine, the president's forces received 10 of the state's 22 votes. A small battle had been won.

And in the end, when the final tally was announced it was clear that the war was over. The Carter forces had overwhelmed Sen. Edward M. Kennedy's last effort to keep his candidacy alive. They had defeated Kennedy on the rule fight by a lopsided margin of 546 delegates. They had firmly taken control of their party's convention. And the presidential nomination was effectively secured.

Just two weeks ago, President Carter's top strategists had concluded they were on the verge of disastrous convention defeat.

The sands of Jimmy Carter's support had suddenly shifted and seemed in danger of being swept away in a tidal wave of disillusionment and disenchantment with the president.

The erosion was partly due to public relations and partly due to political reality. The Kennedy slogan of an "open" convention had caught on among Democrats. And it had come at a time when Carter's standing in the polls had plummeted and the Billy Carter affair was producing questions of major concern -- questions that the White House responses were not answering adequately.

Forty Democratic members of Congress met to talk about rejecting the pleas of the president and coming out for an open convention. The White House and the Carter campaign headquarters were getting calls reporting delegate slippage in a number of key states.

Donilon, after some quick calculations, reported to his colleagues that, unless the erosion was halted, the rules fight probably would be lost.

Publicly, the Carter officials built a facade of optimistic statements to show the media and the nation. Privately they were shaken to the core of their overconfidence.

Robert Strauss, Carter's campaign manager, vacationing in California at the time, was called back to Washington to work the phones. Hamilton Jordan Carter's chief strategist, had gone to Puerto Rico a few days earlier, thinking magnanimous thoughts about how, perhaps, there was no need even to make the fight on the rule, since the Carter delegates would remain solidly in camp even if they were not bound.

But before Jordan could suggest that to the president, he learned upon his return to Washington of the sudden erosion. Jordan concluded that it was too late for Carter to abandon the rule fight -- to do so now would only look like a retreat in the face of defeat, not a gesture of confidence and reconciliation.

Donilon told the Carter high command that they appeared to be in the midst of a dangerous and dramatic defection of Carter's total of more than 2,000 delegates. It looked like only about 1,750 or so could be counted on to support the president's position on the controversial rule. This gave the president a margin of only about 100.

But the situation showed signs of getting much worse. The momentum was going the other way. The prospect of defeat was real.

Donilon reported to Strauss and Jordan that there were signs of dangerous defection in the large states, in Illinois, 40 of the once-solid Carter delegates now seemed soft, leaning away from the president on the rules fight. In New York, Gov. Hugh Cary, whose dislike for Carter is well known, had been using heavy political leverage on politicians in his state.

This is what the Carter officials feared most -- any sizable shift in major blocs such as those of Illinois or New York would trigger wholesale defections across the country.

Jordan scheduled a luncheon with New York county leaders. The president telephoned New York state pary chairman Dominic Baranerlo of Suffolk County and Brooklyn Democratic leader Meade Esposito to press his case. The will of the voters, as expressed in primaries and caucuses, should be faithfully represented by the delegates at the convention, Carter argued.

Vice President Mondale began calling a list of officials and delegates prepared by Donilon including a number in Illinois. Mondale's administrative aide, Jim Johnson, was dispatched to Illinois to work the delegation.

"In two days, we had found every soft Carter delegate in the country," Donilon said, "and we had targeted every one of them."

The president, the First Lady and other Carter advisers began calling every name on Donilon's list.

But perhaps the most decisive factor in reversing defections was the president's press conference last week. It was a political and dramatic tour de force, in which he laid out his explanations of the controversy surrounding his brother's dealings with the terrorist-supporting government of Libya.

"That press conference turned it around for us sure -- more than anything else," Donilon said. The Billy Carter affair had come to stand for bad judgment but Carter's explanations apparently satisfied many of the wavering delegates. In Kentucky, for instance, Carter forces had identified four delegates as unsure. On Sunday Moore reported to Donilon that all with Carter on the rule -- and all four mentioned that Carter's press conference performance was one reason why.

Tonight, confident again, they pulled the trailer into a circle in the president's corner of Madison Square Garden, and in a mobile home shell they call the "situation room", Donilon took over operating command of Carter's defenses.

The Carter forces, having defeated Sen. Edward M. Kennedy in a year of primaries and caucuses, worked to do it one more time in the battle over the convention rule.

The situation room was connected to the boiler room, and that was next to the press room, and, clockwise, the arrangements room and the VIP holding room and the scheduling room.

In the situation room, Donilon, youngest member of the Carter high command, kept track of the president's prospects through the crucial vote. He was confident throughout the night.

Donilon, in his blue pin-striped shirtsleeves and scuffed brown wingtips, paced back and forth along the narrow aisle that separated a couple of dozen Carter aides sitting beside phone that would put them in instant contact with their assigned state delegations on the floor of the convention.

One by one, the state whips reported by phone that the Carter forces were holding as expected -- and often even beter than that. The problem in Maine had been the major brushfire of the night, and it was quickly snuffed out.

Soon it became a contest in which the whips were not just content to carry their states. The goal, one of them announced, was "zero defections" among the Carter delegates. The whips cheered when their states reported in. aAnd when Pennsylvania finally voted and put the Carter troops over the top, the trailer exploded in whoops and cheers and backslaps. Suddenly, Hamilton Jordan came through the door of the boiler room once again -- this time wearing a dark blue suit coat. And like the general manager entering the winner's locker room, he moved along the aisle, a model of moderated enthusiasm, offering handshakes and calling congratulations, as his players danced in the aisle.

At the end of the trailer, convention manager John Rendon was shouting a reminder that the game was not yet over, the voting was still in progress. "Stay with your states 'til the vote is closed," he said. "Stay with your states."