MADRID -- As Francisco Franco lay dying through the golden Iberian autumn a dozen years ago, Spaniards shared only one firm conviction about their political future: History would know the amiable young man whom Franco had chosen to be his political heir and their king as Juan Carlos the Brief. He was destined to be a figurehead monarch, quickly shoved from the throne by Spain's terrible-tempered political factions, as his grandfather had been in 1931.

The Spanish are lucky enough to have been totally wrong about this engagingly direct and deceptively shrewd royal. Juan Carlos not only still reigns, but is now widely respected for his crucial part in guiding Spain's transition to democracy and an expanding role in Europe since Franco's death in 1975. On the ruins of Franco's dictatorship Juan Carlos has built a modern, politically aware monarchy that minimizes pomp and luxury. He tells a visitor to his comfortable but unpretentious office in the Zarzuela Palace that he has beaten the odds originally set against him by making the monarchy useful and cost-effective in the eyes of his subjects.

Now 49, Juan Carlos serves as a patient backstage conciliator who does not publicly mix in politics or policy disputes (or give on-the-record interviews on matters of substance.) His talent lies in his instinct for moving others back from damaging confrontations, usually without being seen to intervene.

This talent will be tested again when he flies to Washington on Friday for a luncheon meeting with President Reagan. Juan Carlos will seek to reassure Reagan of Spain's commitment to the western alliance, despite the current deadlock over the status of U.S. forces in Spain. And he will try to sense if a friendly resolution to the basing dispute can still be reached short of the dramatic clash both sides are threatening.

In private, the king does not mask his unease with the way Socialist Prime Minister Felipe Gonzalez has demanded that the United States withdraw 72 F16 fighters from Torrejon Air Base as a concession to Spanish opinion. Juan Carlos believes that Gonzalez has picked an unnecessary fight with Washington.

But he also feels that the argument has gone too far in public for Gonzalez to accept now a purely cosmetic solution of moving the planes to another base in Spain. The main question to be resolved, the king feels, is how to meet American fears that the departure of the F16s will create gaps left in western defenses. Juan Carlos deserves a serious hearing on this and on other issues in Washington, his first stop on a 10-day swing that takes him to ceremonial visits to Texas, New Mexico and California.

The king maintains a deep interest in military matters, an interest that helped save Spain's young democracy in 1981 when he faced down a putsch attempt that had the silent support of senior military commanders. Diplomats say he plays a major role in Spain's military procurement decisions.

Moreover, he has shown himself to have a canny ability to read the direction of Spanish opinion and to take a long view of events, habits he developed during the seven years that he spent silently waiting at Franco's side to take power.

Did Franco foresee or perhaps even intend that his fascist state would be dismantled so rapidly? Or did the wily old dictator outfox himself by choosing a democratic-minded monarch?

These are questions that Juan Carlos has spent a great deal of time wondering about, and not even he is sure of the answers. But, with a tone of respect for the generalissimo in his voice, Juan Carlos recalls that Franco once told him to ignore the authoritarian way in which he ran Spain.

"Things will be different when you rule," Franco is reported to have said in 1970. "You will have to do things differently."

Today Juan Carlos spends much of his time reflecting, as does every member of royalty in Europe, on family matters, extended and immediate. He can click off the ages of every monarch in Europe and his or her designated successor, making the point that in too many cases hereditary rulers come to the throne after their prime years.

His own son, now 19, will be 35 when Juan Carlos is 65. The Spanish king has shocked some members of his family and royals in other countries by toying out loud with the idea that he might retire and arrange an orderly transition to his son instead of hanging on to the throne himself until he passes.

To those who say monarchs should die on their thrones, this pragmatist of a king responds that monarchies could die as well from clinging to outmoded tradition in modern societies.