A bit of diplomatic foot-dragging by Spain during the height of the Iran crisis has signaled that the United States can no longer take for granted stopover rights at Spanish air bases for U.S. warplanes on their way to Middle east trouble spots.

Spain's reluctance to allow U.S. F15s bound for Saudi Arabia to land at Torrejon air base outside Madrid caused an expensive rerouting through Lajes, a base on Portugal's Azores Islands, with midair refueling.

The incident underlined the differences between Spain and the United States that threaten to weaken the 25-year-old military relationship between the two countries.

Spanish policy and attitudes raise serious questions about whether the United States can use the Spanish bases to supply Israel in the event of another Middle East war, for example, or to help Saudi Arabia in the event of trouble in that kingdom so rich in vital petroleum.

Spain actually refused to allow U.S. planes resupplying Israel in 1973 to land at the bases -- Spain does not recognize Israel and has cultivated the Arab states. However, U.S. air tankers from Torrejon did fly repeated missions in 1973 refueling planes from the United States airlifting weapons to Israel.

Spain's apparent unhappiness with this situation stems from the fact that Washington and Madrid have conflicting Middle East policies and differeinces of opinion over whether developments like the current crisis in Iran actually involve the defense of the West.

The irony of the U.S. use of Lajes earlier this month was evident. After the 1974 leftist Portuguese military revolution -- which caught the CIA and the Nixon administration by surprise -- U.S. officials were convinced that the Azores base could never be used, as it had in 1973, for Middle East conflicts. That conclusion proved wrong.

At the height of Washington's fears that Portugal was coming under communist influence or control, a high U.S. official in Madrid remarked, somewhat optimistically, that Washington did not really need Portugal or Lajes.

"Portugal makes no difference," he said. "We've still got Iran, Spain and West Germany."

Despite the changes in Portugal, however, Lisbon now permits the U.S. Air Force to use Lajes for vital missions.

Portugal, a member of the North Atlantic Treaty Organization, views events in the Middle East and U.S. interests differently than Madrid. And it now has overcome the exclusion from key NATO committees imposed by former secretary of state Henry Kissinger, who did not trust Portugal's leftist leaders.

The apparent end of Iran's close cooperation with the United States gives Spain a new strategic importance, but the role of Spain and the Spanish bases remain in question.

U.S. officials maintain that under the five-year bases lreaty, which expires in 1981, the United States has "unlimited tranist rights" for planes headed for third countries. Iran and the shah were the beneficiaries of these rights when the Torrejon base was used as a stopover for planes bearing weapons for the Iranian armed forces. Spain raised no objections at the time.

Exactly what happened regarding transit rights for the F15s is not clear. U.S. officials put in a routine request with the Foreign Office. At first the answer was affirmative.

Then it was announced in Washington that the planes were going to Saudi Arabia for political reasons concerning Iran. Madrid promptly withdrew approval even though the flight involved three friendly governments -- the United States, the shah and the Saudi government.

"We didn't want to be taken for granted," explained a Spanish official.

"Perhaps we should have consulted a friend about the mission of the F15s, an American source said. "We used them [the Spanish bases] in 1973, and we should save them for a crucial moment."

The fact remains, however, that the incident over the F15s set a precedent. The American interpretation of "Unlimited transit rights" is now an issue that will be raised if there is a new Middle East crisis and when a new bases agreement is negotiated in coming months.

While it is true that Premier Adolfo Suarez faces an electoral campaign in which the U.S. treaty may become an issue, Socialists and Communists agree that the alliance with the United States must be continued so as not to upset the balance of power in Western Europe.they oppose Spain joining NATO, however.

Apart from a different concept of Western defense and conflicting strategic views on the Middle East, Spain feels that it can extend its influence in the Arab world as U.A. standing drops. Spain's "special role" in the Arab world was a foreign policy cornerstone of the late dictator Francisco Franco. It remains the same under the nascent democracy of King Juan Carlos.