On the podium, as America watched, the Democrats were ending their convention with a waltz of the toreadors.

There was Edward Kennedy, twirling and sidestepping and doing everything possible to put distance between himself and the president.

There was President Carter, dancing as well, doing everything possible to try to position himself alongside his year-long adversary for just one arms-up, hands-clasped moment that is the stuff of which Time cover photos are made of.

In the background there were the men of the chorus, the John Whites and Robert Strausses, doing their all to bring the toreadors together, repeatedly steering Kennedy back beside Carter for one more go at it, as the music blared and delegates cheered. The president, grinning, grabbed the senator's arm with his left hand at one point and pumped a right fist into the air. It would have been a good enough cover photo, only Kennedy managed to begin waltzing again, twirling left and gliding away, his face a frozen tableau of a man sniffing rotten eggs.

This was to have been the climatic political mating dance, the product of a week of compromises on substance and symbolism. But in the end, this mating ritual came off about as successfully as those of Ling-Ling and Hsing-Hsing, and, like the efforts of those lovelorn pandas, all that could be said of it when it was over was that at least the principals wound up in the same cage.

It was an evening that may prove to be a harbinger of what it is in store for the president this fall. It was an evening built around that strange mix of pride and politics.

Pride, as Kennedy was plainly still feeling the bitterness that the campaign had evoked. And politics, as Carter was aware that the signals sent from the podium that night, could help determine whether liberals vote for him in the fall, defect to John B. Anderson -- or just stay home.

Thursday night was to have been one of those perfectly honed convention finales, an evening-long television ad, live and in color, that so often gives a presidential nominee a quick boost in the polls. Carter may still get that quick boost he so desperately needs from the convention, but the night was far from perfection.

The president's speech that night was a message that was well conceived and well written but poorly delivered.It was one of the few times in his political career when he failed to come through for himself when he most needed a big performance.

Appearing nervous and perspiring profusely, the president stepped on some of his applause lines and swallowed others. Even when he seemed to have the delegates responding, for a moment, he could not hold them.

"Can this nation accept such an outrageous [Reagan energy] program?" he called to the delegates. "No-o-o-o-o!" they thundered back. But no sooner had the hall quieted than there came a high-pitched, thin wail -- "No!" -- from the podium, as the president plodded dutifully along, following text.

The president also produced one of the great comic (and perhaps Freudian) inadvertencies of all times when he tried to pay tribute to the late Hubert Horatio Humphrey. His voice shrilling to a high pitch, he hailed "Hubert Horatio Hornblower! -- Humphrey."

The president's performance left a number of his own people disappointed. "A lot of people here liked Kennedy's [Tuesday] speech better, myself included," one Carter aide said, outside the Carter strategy trailer at the close of the convention.

"But these same people," he continued, "myself included, also know that this is a president who has been trying to lead this nation and this party in the somewhat different direction. Don't forget, in 1976, he was running at the head of a party that had lost two elections in a row and that needed to be led in a somewhat different direction."

In 1980, the party chose Carter over Kennedy, who had campaigned on the Democratic staples of lower unemployment rates, lower interest rates and more money for jobs and social programs. The president's advisers are concerned that Anderson may win the support of enough liberal Democrats to cost Carter some of the Northeast industrial states in November.

In New York, especially, they are concerned that Anderson could siphon enough traditionally Democratic support to enable Reagan to carry the state, an outcome that could prove fatal to Carter's hopes for reelection.

Carter officials had hoped that the signal Kennedy would send from the podium Thursday night, by his presence and perhaps his enthusiastic support, would be an important beacon to liberals. But Kennedy's signal proved to be something else. And all a liberal had to do to crack the code was turn on a television set and watch.

The result left some Carter partisans angry. "Kennedy looked like a pouting child," said one pro-Carter official. "It took the luster off the evening's end."

But campaign official Hamilton Jordan, striving for the best possible construction, pronounced himself pleased. "What more could you expect after the tough campaign we've all just been through?"

One senior Carter official who was on the stage at the time says he believes that the look in Kennedy's eyes was caused in part by the sound of the delegates erupting into an electric chant of "We Want Ted!" He believes that Kennedy realized at that moment that those delegates -- and the nomination -- could perhaps truly have been his, had he not bungled the job at the beginning.

Democratic Party Chairman John C. White says he is convinced Kennedy and his followers will work actively for Carter's reelection.

"I know what's going through their minds," he said. He recalled how, as Hubert Humphreys Texas campaign chairman in 1972, he felt bitter and disaffected when George McGovern won the nomination. "Well, I wound up as McGovern's campaign manager in Texas that fall -- but it took me a couple of weeks after the convention to do it," he said.

And one White House official, echoing the message, added: "We will be unified in the fall, but not really because of Carter and not really because of Kennedy.

"Ronald Reagan will unify the Democrats most of all."