The nature of Iran's threat and how to deal with it showed clearly when parliamentarians came to Mecca as terrorists to orchestrate the state-sponsored riots there and Saudi Arabia quietly faced up to its powerful neighbor.

Tehran's control over that act of terror at the Moslem holy place went so far that the Ayatollah Ruhollah Khomeini sent eight to 10 members of the Majlis (parliament). They included at least two known to have tortured prisoners in Tehran's jails. Viewing this and the arrest of Saudi diplomats in Tehran as naked intimidation, the Saudis arrested the entire Iranian diplomatic community in Jeddah as well as a deputy foreign minister sent to ''investigate'' the riots.

Iran's revolutionary regime backed down, which sends a message to the United States. For nearly a decade Washington has bowed under humiliation by the ayatollahs. But the Saudis showed that though the Iranians are not ''moderate,'' they are not suicidal when confronting implacable resolution.

This evidence confounds panicky congressional effort to turn tail and pull the augmented U.S. naval presence out of the Gulf. And it also stamps with utmost folly the effort by the CIA to cover up Iranian terrorism to facilitate the ''initiative'' built around illicit arms sales to Tehran.

The riots in Mecca, far from a last-minute affair, were planned weeks in advance with scrupulous attention to public relations. Less than a day after the bloodshed, the Kuwaiti Embassy in Tehran was under siege by fanatics described by the government as ''relatives of the martyrs of Mecca.'' That was before the names of any of the victims in Mecca could have been known.

Surprised but not intimidated, the Saudis restored order with heavy loss of life. When four Saudi diplomats in Tehran were arrested, there was this steely response: the entire Iranian diplomatic community, 14 men and their families, was taken into custody. Tehran was promised reciprocation: one Saudi beaten, one Iranian beaten; one Saudi killed, one Iranian killed; one Saudi released, one Iranian released.

After the riots, a deputy foreign minister was dispatched to Jeddah uninvited. His Saudi counterpart asked him at the airport whether he had to ''negotiate'' or ''apologize.'' ''To investigate,'' said the Iranian. ''The official was arrested and shipped back home on the next plane.

Within 24 hours, three of the four Saudi diplomats in Tehran were released, the fourth a few days later. That is a salutary lesson on overcoming bluster from a rich, powerful country with a fanatically oriented population of 50 million, nearly 10 times the size of the Saudi kingdom.

To the Saudis, the U.S. attempt to play down Iranian terror during the illicit arms sale was self-delusion for political ends. A devastating example of concealing Khomeini's tactics came during last year's Moslem pilgrimage to Mecca.

Parliament Speaker Hashemi Rafsanjani -- then being courted by U.S. arms sellers -- is believed to have approved sending 175 high-level terrorists to Mecca. They carried cases of explosives destined for Western and Persian Gulf states. But that information was suppressed with the help of the CIA.

Most of those terrorists were arrested, just as they were last week. But when Saudi officials in 1986 consulted the United States about putting the Iranians on trial, they were advised not to. The Saudi government went along with Washington, and Rafsanjani's personal appeal got the terrorists back home.

The terminal point of U.S. pretense that Iranian terror was no problem came several months ago. Not long after the Iran arms scandal was exposed, intelligence specialists uncovered evidence that implicated Rafsanjani himself as a control officer in Tehran for extremist Hezbollah terrorists in Lebanon. That made him a suspect in the June 17 capture of former ABC reporter Charles Glass in Beirut.

Rafsanjani's implication convinced Reagan advisers that further diplomacy is futile. ''Its back to square one,'' one official told us. ''Our original premise was right that as long as Khomeini is alive there is no way to appease or disarm his movement.''

French Prime Minister Jacques Chirac reached that same conclusion six weeks ago after he failed to soften up Iran with a $330 million partial payment for a billion-dollar loan from the shah. The attempt to buy good will was soon followed by the most serious diplomatic confrontation France has ever had with Khomeini over cleaning out a terrorist network inside the Iranian Embassy.

In Le Monde last month, Chirac spelled out the lesson: in dealing with Iran, the correct policy is toughness; against Iranian terrorism, super toughness. The Saudis long have understood this. On the Persian Gulf front, President Reagan finally is showing he understands, even if much of Congress does not.