CAIRO, AUG. 3 -- Iran warned all foreign vessels to stay out of its territorial waters during three days of military maneuvers in the Persian Gulf as Ayatollah Ruhollah Khomeini, Iran's spiritual leader, vowed to take revenge on the United States for the deaths of hundreds of Iranian pilgrims who clashed with Saudi police in Mecca Friday.

The warning to foreign ships came as the U.S.-flagged tanker Gas Prince became the first reflagged Kuwaiti ship to complete a round trip through the gulf. It sailed under U.S. naval escort through the Strait of Hormuz and out of range of Iranian Silkworm antiship missiles without incident, Pentagon sources said. Other reflagged tankers made plans to transit the gulf next week.

The Gas Prince and its American escort were shadowed in the gulf by an Iranian frigate at a distance of 7 or 8 miles, according to the commander of the U.S. Navy's Middle East Task Force, Rear Adm. Harold J. Bernsen, United Press International reported from the command ship USS LaSalle.

The American and Iranian vessels exchanged radio talk, Bernsen said, describing the conversation as a routine identification query. "They said, 'We are an Iranian warship,' " Bernsen said.

Bernsen also said an Iranian P3 reconnaissance aircraft was spotted by the American convoy, "but it didn't come anywhere near the force, so it wasn't of interest to us."

The second reflagged Kuwaiti vessel, the supertanker Bridgeton, damaged by a mine on its maiden voyage in the gulf under the U.S. flag, has finished loading 230,000 tons of crude oil, about 60 percent of its capacity, at Kuwait's main oil port of Ahmadi.

The Bridgeton will transport the oil through the gulf to tankers waiting off the United Arab Emirates' port of Khor Fakkan on the Gulf of Oman and then return to the Persian Gulf port of Dubai in the United Arab Emirates for repairs, The Los Angeles Times reported from Dubai. It is expected there at the end of the month.

Three more Kuwaiti tankers will be reflagged by next week, Bernsen said. Shipping sources said the ships, identified as the Gas King, Ocean City and Sea Isle City, are expected to arrive in Kuwait on Aug. 10, Reuter reported.

Pentagon sources said The Gas Prince, carrying 40,000 tons of liquefied petroleum gas destined for Japan, and its convoy of two U.S. warships cleared the Strait of Hormuz hours before Iran's announced deadline, midnight local time Monday, for the start of its maneuvers.

Tehran radio, monitored in the West, said all foreign vessels and aircraft should avoid Iran's air space and territorial waters for the next three days. The radio said the maneuvers, code-named "Martyrdom," would be conducted by the Islamic Revolutionary Guards to prepare Iranian forces against possible U.S. aggression and pay homage to the hundreds of Iranian pilgrims killed in the holy city of Mecca last Friday.

Deutsche Presse-Agentur, reporting from Bahrain, said the maneuvers will include speedboat squads. Speedboats have been used by the Revolutionary Guards in the recent past to inflict damage to gulf shipping.

Iran has blamed the United States and Saudi Arabia for the deaths in Mecca. The pilgrims, on the annual pilgrimage to Mecca, died in clashes with Saudi police near the Grand Mosque, Islam's holiest shrine. The numbers of dead are still disputed. Iran says 650 Iranians are dead or missing and 4,500 people were injured in the clashes. The Saudis say 402 people, including 275 Iranians, died.

In West Beirut today, a bomb exploded at the Saudi Arabian Culture Center, the second attack against Saudi interests in Beirut in 24 hours. Observers speculated that the attacks could be retaliation for the deaths in Mecca.

Bombs also went off at four tourist hotels in Tunisian resorts, but no link has been established to the incidents in Mecca.

On Monday, Tehran Radio, monitored by the BBC in London, quoted Khomeini as saying Iran would take revenge against the United States at "an opportune time."

Arab nations, except Libya, have expressed their support for the Saudis following the violence at Islam's holiest shrines. Today, Tehran radio said it would send delegations throughout the Moslem world in an apparent effort to stem the wave of anti-Iranian sentiment. The radio report said seven delegations would carry a message from President Ali Khamenei about the violence.

"We hold America responsible for all these crimes," Khomeini said in a message to 150,000 Iranians making the pilgrimage to Mecca. "God willing, in an opportune time, we shall deal with her, thus avenging the children of Abraham."

Khomeini said those killed were the "target of assault and impudence of the mercenaries of the arch-Satan that is the criminal America."

The United States has denied it was involved in the incidents in Mecca.

More than 1 million Moslems prayed for divine guidance at the climax of the Mecca pilgrimage today at the nearby Plain of Arafat, about 15 miles from Mecca, where the prophet Mohammed gave his last sermon. There were no incidents.

Speakers reiterated stern Saudi warnings not to mix politics with religion, telling the pilgrims that they should not let anything interfere with their religious duties.

The tensions in the gulf, meanwhile, were cited as the main cause for a surge in world gold and oil prices today, as dealers expressed fears that the seven-year-old war between Iran and Iraq could soon spread and interfere with the flow of oil deliveries.

Tension began to escalate Saturday when it was reported in Iran that hundreds of Iranian pilgrims in Mecca had died. The Iranians said the Saudi police had fired into the crowd of Iranians. But Saudi officials said not a single shot was fired and that the victims were trampeled to deaths when the Iranian pilgrims stampeded. The next day, angry mobs stormed four embassies in Tehran, including the Saudi mission. Four Saudi diplomats reportedly are still missing and presumed kidnaped.