To the 40 defeated House members who returned yesterday for the lame duck session, Rep. Dan Rostenkowski (D-Ill.) must look like a man who has the best of all possible worlds.

Not only has Rostenkowski a safe seat from Chicago as long as he wants it, he also has his choice of two of the most prestigious positions in the House -- majority whip or chairman of the Ways and Means Committee. Both jobs opened up when incumbents were defeated and Rostenkowski sits just behind both in seniority.

The Democratic whip is appointed by the majority leader subject to the speaker's veto. (Rostenkowski would be speaker today had he not been blackballed 10 years ago for whip by then-speaker Carl Albert who never got over the disastrous 1968 Democratic National Convention he chaired in Chicago.) It has been generally assumed that Speaker Thomas P. (Tip) O'Neill Jr. would prefer his reliable ally Rostenkowski charge of the tax-writing Ways and Means Committee instead of the more independent and next ranking member, Sam M. Gibbons (D-Fla.).

But yesterday O'Neill told reporters he was mind. Majority Leader Jim Wright (D-Tex.) said he had offered the whip job to Rostenkowski. And Gibbons said he had sent word to the speaker that he is as good a team player as anybody.

Rostenkowski would not say what he will do. He seems the sort who would prefer the politically interesting but less-demanding whip's job -- which is third-ranking the leadership -- to the drudgery of rewriting the tax code. However, he may be under pressure from various interest groups to take the Ways and Means assignment.

Should he take ways and Means, a leading candidate for whip would be Rep. Thomas S. Foley (D-Wash.), outgoing chairman of the House Democratic Caucus. But there have been reports the leadership would prefer a less-prestigious junior member who would not provide a threat to Wright or Rostenkowski when the two top leadership jobs open up.