Heavily armed riot police stormed a school for fire-fighting trainees here today to end an eight-day occupation strike in the biggest show of force by Poland's Communist authorities since the start of the country's labor crisis 18 months ago.

The seizure of the compound in central Warsaw, clearly ordered by the top Polish leadership, appeared designed to project a new image of firmness by the government in its dealings with the independent trade union Solidarity. Union leaders, including Lech Walesa, held an emergency meeting tonight to consider possible protest actions as several major factories in the Warsaw region threatened retaliatory strikes.

First signs, however, were that Solidarity would seek to avoid a major confrontation over the issue. Addressing a large crowd outside his Warsaw hotel, Walesa said it was not a proper pretext for an all-out conflict.

"We must stick together, the union is a powerful weapon hanging over the authorities, but it can't be triggered off all the time. Our struggle is just beginning. We must go into the battle with much thought and reasoning, not in a fit of nerves. Discipline is necessary, especially today," he said.

Before the assault on the training school began, the entire area around the compound was sealed off by several thousand soldiers and police. Wojciech Maziarski, a 22-year-old student standing guard outside the school, said a police officer then appealed to the strikers through a loudspeaker to leave the building peacefully.

The appeal was answered by a chorus of patriotic hymns from the trainees gathered inside and yells of abuse from the crowd on the pavement.

"Then the police smashed their way in carrying riot shields. A helicopter landed on the roof dropping more commandos. Next to me some women relatives of the strikers were weeping at the thought of what was happening," Maziarski said.

The 320 trainee fire officers, who were protesting moves designed to impose military discipline on their school, did not put up any resistance. Still wearing green firemen's fatigues or navy blue dress uniforms, they later were driven away from the area in buses and then released.

Several Solidarity officials, including the union's deputy Warsaw chief, Seweryn Jaworski, who had been inside the building at the time, were detained by police for questioning.

Since Solidarity's formation as a result of massive labor unrest in August 1980, the Polish government has used force against protesters on several occasions. The most dramatic was in March when some union activists were beaten up after being ejected from local council buildings in the northern town of Bydgoszcz.

Today, despite early rumors, there were no beatings, but the scale of the police action was much larger and well-organized. A big open air market nearby was taken over to provide parking for about 60 Army and police trucks including several water cannons.

All telex and telephone communications between Solidarity's Warsaw offices and major factories were interrupted during the assault on the compound and for at least an hour afterward. This, combined with the tight security cordon around the school, appeared to be an attempt to forestall any move by the union to send in workers to assist the students.

In many ways, the protest by fire officer cadets can be considered a special case since the school was subordinate to the Interior Ministry, which has never allowed Solidarity activities. Soon after the start of the strike, the authorities ordered that the entire school be disbanded.

After their release, many of the trainee firemen joined students in Warsaw who have been occupying universities and colleges for the past three weeks. The protest, in which 100,000 students from all over Poland are believed to be taking part, began over demands for the dismissal of an unpopular university rector, but has since broadened into a fight for university autonomy.

Jarosz Irenius, a second-year trainee fire officer, described how hundreds of riot police crashed into an assembly hall where the protesters had gathered.

"We were all very nervous but a major said that, if we behaved peacefully, we would not be harmed. When we were led out, the crowd cheered us," he said.

Outside the compound, passers-by jeered soldiers and police who took part in the operation. Despite attempts by Solidarity officials to keep order, there were shouts of, "Do you speak Russian?" and "You should be ashamed of yourselves."

Some people in the crowd shouted Russian swear words at the soldiers but, after the initial tension during the assault, the atmosphere was generally good-humored.

The action against the training school followed repeated warnings by Communist leaders that the government would be equipped with "emergency powers" unless there is an end to strikes. A resolution by the party's decision-making Central Committee last weekend formally obliged Communist members of parliament to vote in favor of the legislation.

According to the government information agency Interpress, one of the proposed bills provides for the possibility of a temporary suspension of the right to strike, a ban on other than religious gatherings, limitation on freedom of movement and an enlargement in the competence of military courts.

It is unclear, however, how long it would take parliament to pass the legislation and to what extent it would be watered down. Many deputies are strongly opposed to any legal ban on the right to strike that could prove unenforceable.

The majority view of political analysts here is that, despite the tough warnings, the authorities are still seeking to avoid a final showdown with Solidarity. The party leader, Gen. Wojciech Jaruzelski, is attempting to combine firmness with conciliation in his dealings with the union and is still canvassing the idea of a front of national unity.

All this, however, is taking place against a backdrop of mounting economic disruption and social tension. There is a danger that local incidents such as the firemen's protest could get out of hand and lead to clashes between a desperate population and the security forces.

The forcible ending of the strike at the training school places the Solidarity leadership in a difficult position. Some officials fear that, in the absence of any vigorous reaction by the union, the incident will appear to vindicate those in the Communist Party who have been demanding tougher action against protesters.

On the other hand, any large-scale counterprotest also carries great dangers for Solidarity. In view of the economic crisis, the strike weapon is no longer as effective as it once was, and it is doubtful whether the union can drum up the same degree of support as in the past.