WARSAW, NOV. 27 -- Lech Walesa, having failed to win a majority in the first round of the Polish presidential election, vowed today to work with his estranged colleagues in the splintered Solidarity movement to defeat "the third force" of surprise independent candidate Stanislaw Tyminski.

Tyminski, a wealthy emigre businessman who promises voters a "democracy of money," rattled the Polish political establishment on Sunday with a second-place showing that put him into a presidential runoff on Dec. 9 against Walesa.

Prime Minister Tadeusz Mazowiecki finished an embarrassing third behind Tyminski, who until this month was a political unknown. The result was a stabbing rebuke to the government's "shock therapy" program of free-market reform. Mazowiecki announced his resignation on Monday, but agreed today to stay on as head of a caretaker government until a new president takes office.

"Tyminski is a lesson for us," Walesa said at a news conference, referring to himself and the intellectuals and technocrats who serve in Mazowiecki's government. "I kept saying that the masses don't understand us and that there will be this third force."

A prominent member of Mazowiecki's team said today that the prime minister and his supporters now have no choice but to join forces to help elect Walesa. Before Sunday's vote, Mazowiecki and many of his advisers were describing the union leader as a demagogue and an incipient dictator. With the rise of Tyminski, Walesa has suddenly become much more palatable to the Warsaw establishment.

"In this competition between Walesa and Tyminski, we have only one statesman, one honest man, one national leader. We have Walesa," Bronislaw Geremek, who led Solidarity's legislative caucus until he was forced out by Walesa this fall for supporting Mazowiecki, said in an interview.

Besides asking the Mazowiecki camp to support him in the runoff against Tyminski, Walesa asked Mazowiecki to stay on as prime minister until elections for a new legislature are held sometime in the spring. Mazowiecki's resignation "was not good because the temperature in Poland at this moment is high," Walesa said. "I will ask that we go to parliamentary elections with minimum changes {in the government} or even without them."

Geremek said, however, that "It is absolutely impossible for the government to stay in office" after the presidential election.

"Walesa must take the responsibility for the country," Geremek said. "The supporters of Mazowiecki must get out and campaign to create a new political force that would be an independent opposition force in the new parliament."

Echoing the complaint of many longtime Solidarity activists, Geremek said that Walesa, for the sake of his presidential ambition, destroyed the national consensus that supported the painful reforms undertaken by Mazowiecki's government.

"Walesa, of course, is more statesmanlike than Tyminski," Geremek said. "But one cannot forget that Walesa created the conditions this year that made possible the Tyminski phenomenon.

"Walesa's promises created aspirations that are impossible to keep in Poland. He promised there would be no unemployment, no factory closings . . . . He created a competition of populist slogans and created a situation in which Tyminski could attain success."

Voting results showed that Tyminski, whose campaign speeches promise Poles that they, too, can become rich like him, scored particularly well in the poorest and most industrially blighted parts of Poland.

In his own news conference today, Tyminski said he always had expected Walesa and his Solidarity colleagues to join forces against him.

The independent candidate reiterated his opposition to Mazowiecki's reform package, which he has called a "cruel mechanism of enslavement of our country." Tyminski, however, offered no specific alternatives other than saying that debts should be paid and large international companies should invest in Poland.

In an extraordinarily combative meeting with the Polish and international press, Tyminski complained angrily about coverage that he said was biased, distorted and full of "lies, lies, lies."

He surprised reporters by defending outgoing President Wojciech Jaruzelski for imposing martial law in December 1981, saying, "I hope that this country understands now how much has been done for it by President Wojciech Jaruzelski, because at that moment the country was in unusual danger . . . from within." Challenged to explain further, Tyminski refused and seemed to back away from his statement.

When told by reporters that Walesa supporters were threatening to release information about him that would be politically damaging, Tyminski threatened back: "I am also in possession of information, which I hope I will never have to reveal, for it would be of great harm to our country."