When a fired-up Ronald Reagan came to Capitol Hill Friday bearing still more tax goodies, House Democrats faced the grim possibility they had sold their ideological birthright without the payoff of the congressional victory they crave.

Rank-and-file Democrats have been grumbling that the tax bill crafted by Rep. Dan Rostenkowski, chairman of the Ways and Means Committee, stood for no party principles. But they consoled themselves with the high probability of beating President Reagan on the House floor -- at last.

Such certainty ended with Reagan's final version, which may have won the long, unseemly legislative auction between the president and Rostenkowski By submitting to the indexing of income tax rates (to ease inflation), after his three years of rate cuts, the president is offering a continuing tax reduction system. That final bid, which cannot be topped, fits Reagan's supply-side economics. In contrast, the Democratic bill bears no ideological label.

Win or lose on the House floor, the Democrats have sacrificed the chance to offer the country a philosophically coherent alternative to Reaganomics. While any such plan would have been a certain loser, it would have fulfilled an opposition party duty of sending a message to the country. "I think the function of the opposition is to oppose and maybe even to lose," a Democratic strategist told us. "Danny did not take that course."

Proud and ambitious, Dann Rostenkowski did not want to be rolled in his debut as Ways and Means chairman. A skilled Chicago backroom politician, he was preoccupied with building a House majority on taxes that would contrast with his party's budget defeats. Aghast at blatant appeals to business interests. Speaker Thomas P. O'Neill told a friend: "Danny is interested in preserving an institution -- the institution of Ways and Means Committee chairman."

By mid-July, rank-and-file discontent with the chairman's overtures to business greed was growing. But Treasury Secretary Donald T. Regan kept matching or topping Rostenkowski's offer. Thus, the Independent Petroleum Association of America put its full weight behind the Reagan bill as outdoing Rostenkowski's oil tax concessions that infuriated liberals.

That represented a hard-headed decision that Reagan's bill offered more to wildcatters. But even when Rostenkowski's temptations were juicider, business lobbyists backed Reagan. The National Federation of Independent Business backed the president though many small businessmen prefer the simplicity of Democratic "expensing" of new equipment over Republican depreciation. Old love bested monetary passion.

Still, as Reagan returned here July 22 from the Ottaw summit, Democrats felt they had the votes. Six conservative Democrats from Texas, Louisiana and Oklahoma, all defectors on the budget, gave their commitment to Rostenkowski on his oil bid before Don Regan topped it. Furthermore, Rostenkowski was counting on at least six Republican defections and maybe twice that many to seal victory.

On July 23, Rep. Barber Conable, senior Republicn on Ways and Means, went to the White House to pronounce the battle lost without a Reagan counterstroke. Conable told Regan and White House chief of staff James A. Baker III that the answer was fourth-year tax indexing (already passed in the Senate), not only a favorite of House Republicans but sponsored by some 60 Democrats.

At that meeting, Conable's Democratic co-sponsor, Rep. Kent Hance of Texas, pressed his appeal -- previously rejected by Secretary Regan -- to reduce the one-year holding period on capital gains to six months. Regan finally agreed when Rep. Jack Kemp, chairman of the House Republican Conference, and budget director David Stockman backed Hance.

When Conable announced the indexing decision to the House Republican Conference July 24, a spontaneous cheer rang out. President Reagan then brought laughter when he ridiculed the Rostenkowski bill as giving workers a bigger tax break "if you're only planning on living for two years." By proposing a semi-permanent tax cut, Reagan had regained the initiative.

That could affect such fence-sitters as Rep. James Jeffords, a liberal Republican from Vermont not overly enamored of Reaganomics. But he likes indexing and suspects the Democratic bill is the more lucrative for big oil. Reagan's last-minute addition of a tax credit for wood-buring stoves, a pet proposal of Vermonter Jeffords, did not hurt.

Headcounts still show Reagan seven votes short, but emotion on Capitol Hill has turned in favor of the president, suggesting that ideology -- Jim Jeffords aside -- is important after all. Loaded down with goodies though it is, the Reagan program is faithful to an economic philsophy. The contrasting failure of Danny Rostenkowski's bill to convey a message explains the joylessness in Democratic ranks, win or lose.