Poland's Communist leadership removed five government vice premiers and 13 of 30 Cabinet ministers today in the most extensive shake-up since Gen. Wojciech Jaruzelski took power in 1981.

The moves, which included the removal from key government posts of men regarded as the leaders of both liberal and hard-line groups within the Communist Party, appeared designed to consolidate Jaruzelski's authority and prepare the government to deal with economic and social issues.

On balance, however, the reorganization and new government course dealt a setback to Poles seeking a political liberalization, diplomats and political activists said.

In addition to the demotion of Communist leaders regarded as reform-oriented liberals, the government signaled last Saturday a continuing toughness toward its opposition by sharply limiting a promised release of political prisoners.

The government reorganization follows Jaruzelski's retirement as premier last week in favor of Zbigniew Messner and several key changes yesterday in the party's leadership.

Jaruzelski, who took over the post of president of the Council of State, has engineered the changes from his position as first secretary of the Communist Party and commander in chief of the armed forces.

Although long anticipated, the extent of the shake-up surprised western diplomats and party activists, who had expected Jaruzelski to move more cautiously.

The breadth of the action, these sources said, seemed to reflect Jaruzelski's confidence in his political strength following legislative elections last month that the government labeled as proof of Poland's growing stability.

"The social and economic normalization that has been realized gives us the possibility of a wider activity based on a long-term plan," said Premier Messner in proposing the new ministers to the Sejm, or legislature. Government spokesman Jerzy Urban added: "The center of gravity in Poland is shifting toward economic and social issues."

The new ministers appointed today to the Presidium and Cabinet included few well-known public figures or independents. While the post of minister of economic reform was eliminated, the key economic ministers of finance, heavy industry and wages were left in place. "The continuation of present policy," said Messner, "will be the main principle of the government."

The most important change in the Cabinet was the removal of foreign minister Stefan Olszowski, 55, a political veteran who was considered a leader of hard-line opposition to Jaruzelski within the government and party. Olszowski, who was ousted yesterday from the ruling party Politburo, appeared to have been eliminated at least temporarily as a political actor in Poland despite reportedly strong connections to Moscow.

Olszowski was replaced as foreign minister by Marian Orzechowski, 54, a former party Central Committee secretary, university rector, and alternate member of the Politburo since 1983. Political sources said Orzechowski appeared to be a loyal follower of Jaruzelski without a strong political profile of his own.

Jaruzelski's apparent success in eliminating Olszowski as a potential rival was balanced by the demotion of Mieczyslaw Rakowski, a close adviser of Jaruzelski who was removed as a deputy premier.

Rakowski, long considered a leader of liberal activists in the Communist Party, was named vice speaker of the Sejm last week and will head an economic council that government officials said would be reorganized and strengthened.

In addition to Rakowski, four other vice premiers were removed, leaving only two members of the formerly nine-member Presidium in that policy-making organ along with Messner. Only three new vice premiers were named, and party domination of the Presidium was increased.

Nine Cabinet members were replaced, and four other ministers' posts were abolished. The most important changes in addition to the change of foreign minister came in the ministries of foreign trade, health, youth, education and construction.

Not all of the removed officials will lose their political influence. One former vice premier, Roman Malinowski, was elected last week as marshal, or speaker, of the Sejm. Another, Zenon Komender, was named to the Council of State, the largely ceremonial collective presidency whose functions are expected to be upgraded since the naming of Jaruzelski as its president.

Messner, 56, an economist and former first vice premier, focused a lengthy address to the Sejm today on economic and social policy, saying "the second part of the 1980s will decide Poland's future."

The new premier stressed the government's intention to continue with market-oriented reform of the economy and announced several new measures, including the freeing of many prices from government controls and the outlawing of wage increases that exceed gains in productivity.

Messner said Poland needed to improve its exports to pay its large foreign debt and warned that "service of the debt requires considerable resources and is not possible without the normalization of financial and credit relations" with western countries.

Noting that some western governments had withheld new credit lines from Poland, Messner declared that "Poland cannot be the only country in debt in which the creditor countries are not helping, but on the contrary creating obstacles through economic restrictions."

Addressing foreign policy, Messner said the government was interested in improving relations with the United States "on the condition that sovereignty is respected."

"We expect the United States to give up its unfriendly policy . . . and a total lifting of sanctions against the Polish economy," he said.

Earlier today, spokesman Urban said at a press conference that some of the officially acknowledged 368 political prisoners already had been released under a "humanitarian initiative" by the government and that a majority eventually would be freed after review of their cases by prosecutors, courts or the Council of State. He added, however, that investigation of Solidarity union leader Lech Walesa on two separate charges would not be affected by the program.