JUAN CARLOS of Spain has been welcomed as Washington's favorite king, and deservedly so. His countrymen, never especially partial to the monarchy, regard him as the chief custodian of the democratic order that replaced the dictatorship in Spain. He had a uniquely demanding chance to prove it last February during an attempted coup. Coolly, this prot,eg,e of Generalissimo Franco held the armed forces to their oath of loyalty to the civil order. Spain's fledgling democracy survived.

In his talks with Juan Carlos, President Reagan enthusiastically freshened American support for early Spanish entry to NATO, something that was out of the question before Spain had turned the democratic corner. Mr. Reagan spoke of the strategic advantages, and these, considering Spain's military facilities and potential, are significant. There is also a useful political aspect. By joining NATO, Spain's still tradition-ridden armed forces are more likely to be drawn out of Spanish politics and into matters of defense in a broad alliance context.

The Spanish government is moving toward a parliamentary vote on applying to NATO, having rebuffed an effort by the Socialists and Communists, who tend to oppose entry, to hold a national referendum on the question. In a way it is regrettable that such an important move will not receive the extra legitimacy of a popular mandate. The government, however, saw no good coming out of the agitation that would have accompanied a referendum campaign.

There was perhaps only one curious note in the king's Washington stay. He is reported to have offered to use Spain's "excellent ties" with various Arab leaders to promote peace in the Mideast. Spain does have excellent Arab ties. But it refuses to open diplomatic relations with Israel. This is an obsolete and petty attitude on Spain's part, one not befitting a country whose ambition is to be accepted unequivocally into the Western democratic community. What better contribution could it make to peace at this point than to show by its example that it is possible and necessary for all states of the Mideast to accept each other and to live normally side by side?