To the surprise of almost everyone, including themselves, the congressional Democrats have come close to stealing President Reagan's thunder in the first round sparring for political advantage on the tax reform issue.

But when the last round arrives, it's still a good bet that Reagan will have his hand raised in victory -- unless his own partisans in Congress throw the fight.

The Democrats gained the initial advantage when Reagan delivered less of a populist TV pitch for his tax plan than the White House had advertised, and when House Ways and Means Committee Chairman Dan Rostenkowski (D- Ill.) filled the vacant screen with the kind of straight-from-the-shoulder talk the people have not heard from Democrats in a long time.

Instead of Reagan sounding like FDR, as this reporter had mistakenly predicted, Rostenkowski came on like the Harry Truman of the 1948 campaign. Reagan had the high- blown rhetoric, which was effective enough in its own way. But the lines that reached the gut were uttered by the man from Chicago most people were seeing for the first time. "Why should a bank teller pay a higher rate of taxes than the bank she works for?" Rostenkowski asked. "Why should a gas-station attendant pay a greater share than the oil company?"

Republicans from Rep. Jack Kemp to retired Senate majority leader Howard H. Baker Jr. described Rostenkowski's speech in glowing terms, and Democrats quickly picked up their cues from him. By mid-week, all of them were portraying themselves as the protectors of the middle-class wage earners in the coming congressional battle.

That is why many Democrats gave a big sigh of relief and said -- in the words of one House leadership aide -- "I think we've dodged the bullet."

But Reagan still gained some points by putting his stamp on the issue, and he has a chance for a larger long-term win if his teammates do not sabotage him.

The immediate advantage is the one Democratic National Committee Chairman Paul Kirk acknowledged in an interview. "Tax reform allows Reagan to change the subject, to get off the defensive," Kirk said. An official at the Republican National Committee agreed that "compared to MX missiles, aid to the contras or budget deficits, I'd sure rather have the president out talking about this issue."

Looking ahead, many Republicans also see the Rostenkowski strategy as improving the chances for early passage of a tax package. By declaring they would improve, not oppose, Reagan's proposal, the Democrats have put themselves under obligation not to sidetrack the measure in the Democratic-controlled House.

The Republicans may be overestimating Rostenkowski's cooperativeness and underestimating his guile. A congressional ally predicted the Ways and Means chairman will search during hearings for "specific examples of unfairness" in the Reagan plan. If they are found, he said, they will be used to undermine the credibility of the Reagan approach "just the same way we've used the overpriced toilet seats and wrenches" to turn opinion against the president's defense proposal.

But Rostenkowski clearly does not want to see tax reform die in the House. And "when it passes," said Republican pollster Robert Teeter, "Ronald Reagan will be sitting there smiling, handing out the pens, and say- ing 'This is what I've been for all my life.' However much it may be altered en route to the White House, Teeter argued, "it will be one more step toward the Republicans' identification as the party of lowered taxes. . . . A tax system that's seen as more fair is not going to turn young, middle-class voters into Republicans in one fell swoop. But it's another step in convincing them Republicans have the country moving on the right path."

These long-term GOP hopes depend, of course, on the Republican Senate's cooperation. Baker, the former Senate leader from Tennessee, said that should be a cinch "unless someone screws up." But others are not so sanguine about the Senate, and suspect that Baker may deliberately be putting his successor and potential 1988 presidential rival, Sen. Bob Dole, on the spot.

An administration strategist said last week: "If we've got a 50-50 chance of getting a decent bill through the House with Rostenkowski's help, you'd have to say the odds in the Senate are worse. I'd say less than 30 percent chance today."

The Senate Finance Committee has a higher proportion of special-interest representatives than Rostenkowski's counterpart committee. The few passionate proponents of reform in the Senate do not include Dole, a powerful member and former chairman of the Finance Committee, new chairman Bob Packwood or ranking committee Democrat Russell Long. Sen. Gary Hart, a reform advocate who is not on the Finance Committee, does not exaggerate when he calls it "the graveyard of reform."

"The worst of all possible worlds for us," said a Republican strategist, "would be if the House Democrats pass a more populist version of tax reform than the president has submitted, and then it is killed in the Senate. I don't think it will happen, but that is my nightmare."

Preventing that nightmare is the biggest challenge facing Reagan and the Republican Party.