They were once the fiercest of rivals, the refined senator from Massachusetts and the scrappy ex-governor of Vermont, but for 24 hours this week, John F. Kerry and Howard Dean made it look as if they were the best of friends.

The two Democrats campaigned together in Portland, Ore., traded notes on health care and played cards on Kerry's plane, and for nearly an hour fielded questions together from reporters on a long flight back to Washington on Tuesday evening.

Their candidacies moved like opposite ends of a teeter-totter through much of last year and in the early months of this year, with Kerry initially seen as the front runner for the Democratic nomination, only to be eclipsed by the energy and passion generated by Dean's antiwar candidacy. When Dean stumbled at the end of last year, Kerry eclipsed him, upsetting Dean in Iowa and cruising to the nomination.

If Dean harbored any bitterness over what happened to him, he did not show it as the two chatted with reporters, with Dean volunteering his admiration for what Kerry had accomplished.

"I certainly admired you for kicking my [expletive] in Iowa," Dean said to roars of laughter and a quick high-five from the victor.

Dean is still the more exuberant, Kerry the more restrained. The former governor has shed some of the weight he gained during a campaign that saw him running flat out on a diet consisting almost exclusively of junk food. Kerry has gained back some of the weight he lost during a stressful fall, in which his campaign seemed all-but-doomed to even some of his own supporters.

During the primaries they fought over tax cuts for the middle class, free trade and especially the war in Iraq, with Dean denouncing Kerry for supporting the resolution authorizing President Bush to go to war unilaterally if he chose.

Aboard the Kerry charter, Dean said, "You know, there wasn't a helluva lot of difference in all our platforms, really."

Earlier, at a campaign event in Portland, Kerry had praised Dean for having "helped to focus the conversation" of the campaign in a way others had not. Asked what he meant, Kerry began by saying that his own campaign is still running on the principles and ideas he first enunciated in December 2002, when he announced that he would become a candidate. "But I think Howard was the first person after that to sort of publicly break through," Kerry said. "And that helped to shift the dynamic. It's just a reality. And it was very helpful. It changed the way the next weeks and months of our discussion went on."

A reporter suggested that Kerry's stump speech now contains elements that once were part of Dean's and asked whether Dean had "raised the bar" on Kerry's performance. "I think everybody did," Kerry said. "I think he did, but I think the whole process does. I think running for president requires that. I learned a lot. I readily admitted that; said it in Iowa, said it in New Hampshire. I'm still learning a lot. I'm still working at being a better candidate. I think I am. I think we're getting there. You know, you've just got to keep working at it. If you don't [keep] learning this business every single day you've got to get out of it."

Kerry then described watching a tape of one of his recent campaign events and being unhappy with what he saw. "I just felt that I could have communicated more effectively," he said without explanation.

Dean then picked up the thread of the conversation. "You want to make yourself feel good though -- I've done this on our stuff -- you look at the tapes when you first started," he said. "It's unbelievable. It is amazing. I knew this was a growth experience but I didn't realize how much until I went back."

Dean was standing in the aisle of the plane, surrounded by reporters with their digital recorders straining to retrieve the words over the din of the engines. Kerry was seated in the adjacent row, calmly listening.

Dean, whose mouth often got him into trouble when he was a candidate, continued: "You remember the South Carolina debate, which was a disaster for both of us. It was the very first debate out of the box, when was it, a year ago? I looked at that and just went, 'Oh, man.'" Kerry's face remained impassive, offering no hint that he either agreed with or appreciated Dean's assessment of that debate, in which the two had tangled publicly for the first time, with both the poorer for the effort.

Dean remains the more spontaneous and looser of the two, but he now plays a subordinate role to Kerry when they appear in public.

Dean said he spends about four days a week on the road now, part of it building his own organization, called Democracy for America, an effort to maintain the Dean network around the country. But he said he is prepared to do whatever Kerry's campaign asks. Sometimes that means watching what might have been. As Kerry's traveling entourage prepared to leave Portland on Tuesday afternoon, the candidate was busy posing for pictures with police officers and others, constantly surrounded by well-wishers and admirers. Dean stood alone near Kerry's plane, talking on his cell phone but constantly watching the scene as Kerry made his farewells.

When they are together, Dean's job is to provide generous introductions, as he did Monday night at an enthusiastic rally in Portland's Pioneer Courthouse Square that included many of his former supporters who are trying to warm to Kerry as their nominee. "I want my children . . . to be citizen[s] of the United States of America led by a man like John Kerry, who served his country with patriotism and valor and stood up for what was right," Dean said. "But I also want somebody who understands right from wrong."

For Dean, traveling with the nominee also can mean sitting mostly mute on a stage with Kerry, as he did Tuesday morning at a workforce training center. At times, as Kerry fielded questions, Dean looked as if he was restraining himself from breaking into the conversation and he said that a reporter had asked him if he felt odd to be sitting at Kerry's side after the intensity of their competition. "I said no, it was kind of fun because I was admiring the craft [of campaigning]," he said. "You know, there's a craft to this, there's a skill set to this. There have been 58 Democrats who have run for president in the last, I think, 36 years. And that's not a big lot of people in that period of time who go through this. I think there really is kind of a fraternity-slash-sorority to doing all this. It wasn't hard for me at all to put this aside."

It was then that he described his admiration at having his back side booted around Iowa. Earlier Dean had said his determination to see Bush denied a second term in November made it easier not only to endorse Kerry's candidacy but also to work actively in Kerry's behalf.

"I didn't have a moment's hesitation on Feb. 18th when I dropped out of the race that I was going to support John Kerry," he said. "I said so at the time and I wasn't kidding," he added. "And the reason for that frankly is that all of us, I think, have in some ways come out of the wilderness in the Democratic Party and all of us are determined to make this country in the image of what it should be, which is the moral leader of the world, a position we held until George Bush did what he did on his way into Iraq."

Kerry said the door he has opened to his rivals is part of the process of learning to lead his party as its presidential nominee. "It's an inclusive business and if you're going to president and make your country work, you'd better start by making your party work and reaching out," he said.

Dean said he misses the campaign trail and he took time to catch up with some of the reporters on Kerry's campaign who had ridden his campaign planes and buses, played card games with him on late-night flights and who chronicled his rise and especially his fall in Iowa and New Hampshire last January.

Did he see it coming in Iowa, he was asked as the free-flowing news conference was breaking up? "No, I thought we were going to win," he said. He sensed slippage but was blindsided by what hit him.

"I thought we had a shot," he said. "The last couple of days didn't feel right. But I thought we had a shot."