WARSAW, Poland (AP) _ The government of Prime Minister Zbigniew Messner resigned Monday after strong criticism of its management of the economy. A lawmaker later asked Parliament to legalize the banned Solidarity labor movement.

Messner, prime minister since 1985, announced in a speech to parliament that he and all 19 ministers were resigning. He defended his government's performance but conceded ''mishaps'' in not standing up to inflationary wage demands.

It was the first time in Poland's postwar history that the entire government stepped down. Messner said the mass resignation would make it easier for parliament to make ''proper decisions'' about the future government.

The Sejm, or parliament, approved the resignations near the end of a 12- hour session Monday by a vote of 359-1, with 17 abstentions. A new government was expected to be named by the Sejm this month.

Messner or some of his ministers could be reappointed.

The issue of Solidarity and the name of Lech Walesa, founder and former head of the outlawed independent labor federation, came up repeatedly in the free-wheeling discussion of the economy and government that followed the resignations.

Inflation caused a wave of labor strikes in April. A second wave of strikes in August ended when authorities and Walesa agreed to hold broad-based talks, now scheduled for next month, that may include the issue of legalizing Solidarity.

Solidarity ''should regain its proper place in the trade union movement,'' Ryszard Bender, an independent parliament member from Lublin, told parliament Monday. ''Apart from associations, apart from Solidarity, ... there is also a need to have new political parties.''

It was the first call in parliament for legalizing the union movement since Solidarity was suppressed in December 1981 with the imposition of martial law.

Turning to address Polish leader Gen. Wojciech Jaruzelski, Bender urged that Jaruzelski and Walesa, ''the first Nobel Peace laureate in Polish history,'' meet and make a joint statement concerning Poland's ''most vital interests.''

Jaruzelski smiled slightly but showed no other reaction to the remarks.

Later Sejm deputy Aleksander Legatowicz, an economist, said the government failed because ''it closed itself off from criticism.''

''There are people allergic to the word 'socialism' and others allergic to the word 'Solidarity,' '' he said.

Solidarity, the first free trade union movement in the Soviet bloc, emerged from a tumultuous summer of labor unrest in 1980.

About 30 deputies spoke Monday, with several endorsing the planned round- table talks with the opposition. Bender was the only speaker openly calling for reinstatement of Solidarity.

Deputy Sylwester Zawadzki said ''extreme demands'' such as calling for trade union pluralism ''may not make reconciliation easier.''

Under Poland's system, the Communist Party led by the Politburo is the actual seat of power and appoints the government through its majority in parliament. As first secretary of the Politburo, Jaruzelski is the country's leader. The government is responsible for executing the party's goals.

The party leadership has maintained that its goals for reforming the economy and political system have been correct but implementation by Messner's government has been faulty. The Soviet press also has recently criticized the Polish government.

One speaker suggested last Friday that the government was being used as a whipping boy.

''The situation resembles a soccer game,'' said Tomasz Adamczuk, a member of the Communist-allied Peasant Party. ''The players are the political parties, the Polish trade union alliance, the opposition and others. The ball is the government.''

In Washington, State Department spokesman Charles Redman welcomed the understanding reached Friday between government negotiators and Walesa on future talks.

Redman said Monday that ''a process of national reconciliation may have begun, and all sides should strive to realize its historic potential.''

In his speech, Messner appeared to question the recent emphasis on dialogue with the opposition. ''We are paying for (the strikes) now with escalation of demands and greater chaos in the market, loss of authority of management. We again have become a symbol of anarchy in the world,'' he said. ''Political methods of solving tensions cannot mean tolerance for law-breaking.''

Immediately prior to Messner's speech, parliament heard a critical report from a committee set up to monitor the government's performance in implementing economic reform. Its chairwoman, Krystyna Jandy Jendroska, cited the dismal performance of the economy in the areas of inflation, production, housing, agriculture, taxes and investments.

She urged that more ''coalition forces'' from outside the party be brought into government, including experts in the economy.

The criticism of the government echoed statements at a Communist Party plenum Aug. 27-28, during the wave of strikes.

The government was criticized as sluggish and ineffectual in implementing a broad economic reform plan this year and for its handling of price increases that have led to annual inflation of 60 percent.