Communist authorities and the idependent trade union federation Solidarity agreed today to hold formal talks in an attempt to resolve Poland's labor crisis. But the government warned later in a televised statement that it would take "necessary" steps to combat continued wildcat strikes.

The decision to hold the negotiations, scheduled to begin Friday, breaks a nine-day deadlock during which both sides appeared to be hardening their positions. Talks between the government and Solidarity broke down on Wednesday of last week on the issue of free Saturdays.

The government statement said continued "chaos and anarchy" were endangering Poland's future and that forces "hostile to socialism" were becoming more active. It hinted at emergency measures if local wildcat strikes continue.

"According to its constitutional prerogatives," the official statement said, "the government is bliged to ensure order, calm and discipline and create conditions for the normal life of this country's citizens. The government therefore states that in the event of the present situation continuing, it will have to take indispensable decisions to allow the normal functioning of factories and plants in accordance with the highest social interest."

Observers here said the tough government statement seemed aimed at bolstering its negotiating position.

Despite appeals by Solidarity's national leadership, strikes continued in several parts of Poland today. In the southern town of Bielsko Biala, where workers are demanding to removal of allegedly repressive local officials, about 300 factories remained idle for the third successive day.

The announcement of the new talks came at the end of a meeting of Solidarity's national commission in the southeastern town of Rzeszow, where farmers have been occupying administrative offices for several weeks to press demands for an independent union. In an unprecedented step, the meeting was also attended by the government minister in charge of union affairs, Stanislaw Ciosek.

The importance the government attaches to the new talks was illustrated by the decision to provide a special plane to fly Solidarity leader Lech Walesa to Warsaw Friday from Rzeszow.The union negotiating team will include three farmers' leaders.

A Solidarity spokesman described recognition of an independent peasants' union as "a basic demand" to be raised at the talks. Formation of a "Rural Solidarity" has, however, been rejected by communist leaders on the ground that it would amount to creation of an independent political force in the countryside.

Solidarity has drawn up a list of about 70 grievances for discussion with the government at what will clearly be wide-ranging negotiations. Apart from the farmers' union, the key demands are for a five-day working week and greater access to the news media.

The gravity of Poland's problems was underlined at today's meeting in Rzeszow by both government and union representatives. Ciosek described the situation as "dramatic," adding: "We stand on the threshold of crisis, perhaps we have even over-stepped it."

His words were echoed by Walsa, who appealed again for an end to uncoordinated local strikes, saying Solidarity had to prove it is in control of all its members. The union has called for a nationwide one-hour "warning strike" next Tuesday unless agreement is reached with the government.