SPAIN IS IN perhaps the most perilous stage of its daring passage from dictatorship to democracy. The government of Adolpho Suarez is moving resolutely in three policy areas, any one of which would be difficult enough to test the constancy and flexibility of a political system accustomed to representative government for decades.

First, Premier Suarez is coping with a surge of terrorism that took the lives of five Communist lawyers and two students of the left, in addition to three policemen. Several high officials have been kidnapped as well - although two of the highest ranking kidnap victims have since been rescued in a daring helicopter operation by an armed police force. Whehter these acts are the work of left or right extemists, perhaps the one posing as the other, is unclear. No matter: The government must keep order without allowing the preparations for parliamentary elections next May be thrown off; it was with this in mind, undoubtedly, that the dramatic rescue operation was launched. So far, the task of maintaining order has been left to the police rather than to the army, whose recall to policing duties would gravely damage the otherwise growing luster of civilian government. But the search, arrest and control powers available to the police have been expanded in the campaign against the terrorists. King Juan Carlos is tending carefully to the military's anxieties. Premier Suarez is holding firm. But it is a close thing.

Mr Suarez, preparing for elections in which, as he realizes, all responsible elements of the political spectrum must be represented, is now experimenting with a new formula to bring the Communist Party back into the legal political arena. Under a plan that the opposition (including the Communists, who, though outlawed, are tolared) helped draft, the party could petition the Supreme Court to shed its status as an "illegal association." The pro-Franco right, of course, is outraged. The party, whose respectability in the past arose from its anti-Franco activity, is working now to show itself independent of Moscow. It criticizes Soviet-bloc human rights violations, and its leader, Santiago Carrillo, plans to meet with his "Eurocommunist" counterparts of France and Italy. Premier Suarez is not letting the fight against terrorism interfere with election plans.

Finally, Spain has just resumed diplomatic relations with the Soviet Union, whose support of anti-Franco royalist elements in the Spanish Civil War had led Gen. Franco to break off relations almost 40 years ago. Normalization of diplomatic ties with the nations of the Soviet bloc ends the policy of diplomatic isolation that Spain accetped in the Franco years. The step betokens a mature recognition of international reality. It will be balanced, in good time, by membership in NATO. Moscow will no doubt continue huffing and puffing against Spain's membership, but the Kremlin is plainly resigned to seeing Spain take up and appropriate and natural role in the Western alliance. Solid American support of Madrid's new internationalist outlook is critical here.

It is hard to magnify the importance, or the difficulty, of the passage Spain is undergoing. To make such an abrupt change as Premier Suarez and King Juan Carlos are conducting is bound to strain evey fiber of a nation's being. There are no charts, only shoals. Outsiders may be poorly placed to identify the hazards and opportunities. What Spaniards are doing, nonetheless, is earning them not only the respect but the confidence of others in the West who wish them well.