After the House had passed the most sweeping tax-overhaul bill in 40 years, everyone from President Reagan to poverty workers heaped praise on Ways and Means Committee Chairman Dan Rostenkowski (D-Ill.). But the Chicago machine Democrat was the first to say that he needed the bill as much as it needed him.

"I wanted to prove to the rest of the House that maybe Wilbur Mills was a great chairman of the Ways and Means Committee, but you take on the 'Big One,' and if you can accomplish it, you're the chairman," Rostenkowski recalled yesterday of less glorious days on the committee.

"I used to sit in here with [committee spokesman] John Sherman, and he'd say, 'We gotta punch even our friends to be able to go to the media and say we're taking on the Big One.' The media would say, 'We'll believe it when we see you up to it in your ear lobes.' Well, that's where we are," Rostenkowski said with satisfaction.

Only a day earlier, Rostenkowski had done what was assumed by skeptics as the undoable: getting a Republican president and a balky House to go along with a tax bill that reaffirmed the historic principles of the Democratic Party. Reflecting yesterday on how and why he did it, the blunt-spoken Rostenkowski talked of working people, the Democratic Party, hardball politics and, repeatedly, his own ego.

Only a year ago, Rostenkowski bore the taint of failure for having tried to stop the 1981 Reagan tax bill with a Democratic alternative widely viewed as a "giveaway" to large corporations. Younger members like Rep. Buddy MacKay (D-Fla.) said they saw Rostenkowski as a "wheeler-dealer," who cared less about substance than political horsetrading.

What's more, he had been outmaneuvered in the race to succeed House Speaker Thomas P. (Tip) O'Neill Jr. (D-Mass), consigned to long-shot status at best, behind House Majority Leader James C. Wright Jr. (D-Tex.).

Then in late 1984, along came then-White House chief of staff James A. Baker III, asking Rostenkowski to become Reagan's chief ally on an issue called tax reform. "He was telling me what an opportunity this was, and I said, 'Jim, I've been massaged by the best of them. Your hands are cold,' " Rostenkowski said.

But the master negotiator -- some would say deal-maker -- from Chicago ward politics said he knew even then that this was the Big One. He had already talked to the Chicago business community about the Treasury Department's first tax-overhaul blueprint, unveiled late last year, which would have closed dozens of corporate loopholes.

"That community was looking at me as their savior," he recalled with a chuckle. "They said: 'Danny, you'll never vote for this,' and I said: 'I didn't vote for the fella Reagan . You did.' . . . . They said, 'We can't be for this.' Now I've learned that whenever somebody's in trouble, he uses the plural 'we.'

"So I said to myself: God, this is the great opportunity. The president is a popular fella, and it the issue has all the pluses for people -- get poor people off the tax rolls, revise the tax code, make it more fair. And so my staff and I said let's take on the Big One."

At first, there were smirks about "Rosty the reformer" from lobbyists, liberals and many of those in between. But as the strong-willed chairman kept steering the massive bill through his Ways and Means panel, winning support to curb or eliminate one corporate tax break after another, the jokes stopped.

Early on, the panel balked at a Rostenkowski proposal to narrow a major tax loophole for banks. Instead, the committee voted to widen the loophole, and it seemed to many observers that tax-overhaul had died aborning.

"I was in the valley," Rostenkowski recalled. "I went home to my apartment -- you know, I'm all alone there -- and I wrote myself a letter. It's still in my drawer here, saying how bad I felt. Anytime I want to take the Big One on again, I read that letter."

After the bank vote, Rostenkowski scheduled three emergency sessions over a weekend and promised the rebels that in return for their help, he would preserve the multibillion-dollar deduction for state and local taxes. The bank vote was reversed, saving the loophole for small banks, but not for the big ones.

He then organized his panel into task forces, assigning each to come up with tax packages for different industries. As a result, each provision had a subcommittee behind it, and the rest of the panel was hard-pressed to take on so many colleagues at once.

Rep. Robert T. Matsui (D-Calif.), who became a Rostenkowski ally, recalled that when the panel balked on tough votes, "Danny would talk about his daughter, a flight attendant, and ask us why she should pay more taxes than a big corporation."

In early December, the bill emerged, lowering the top individual tax rate from 50 to 38 percent, and shifting $140 billion worth of taxes in five years from individuals to corporations.

A curious transformation had occurred. Within the panel, Rostenkowski the deal-maker became Rostenkowski the statesman, taking on his allies as well as others'. And the man known for malapropisms and mixed metaphors began to sound downright eloquent to many of the committee members.

The climax came Tuesday, when Rostenkowski had the last words before the vote on the tax-overhaul bill. Speaking extemporaneously from the well of the House, his hands in his pockets, the big, rumpled chairman called on his fellow members of Congress to pass the bill in the name of American working people.

"There's a doubt in the mind of the constituents we serve," he said. "They're discouraged and frustrated because they think those of us in government aren't doing our job.

"As a Democrat, when a Republican offers an opportunity for us to get simplicity and fairness into the code, this Democrat will take advantage of him every time around the block."

It wasn't clear whether Rostenkowski's tongue had slipped, or whether he indeed meant that he had consciously snookered the most popular president since Franklin Roosevelt. But it may explain why he said of his long journey, "I've enjoyed it."