PARIS, JULY 13 -- The tension in relations between France and Iran increased today as gunboats attacked a French freighter in the Persian Gulf and Tehran issued a warning to Paris over the alleged roughing-up of an Iranian diplomat in Geneva.

The French government dispatched a frigate equipped with Exocet missiles into the gulf to protect the stricken, 24,540-ton Ville d'Anvers. No one was injured in the two 10-minute attacks against the freighter.

In an apparently related announcement, Iran cautioned France against the "disastrous consequences of its attitude" in the treatment of a diplomat who suffered injuries in an encounter with border police as he sought to enter France through Geneva airport.

French military sources said sending the 340-foot frigate, Victor-Schoelcher, into the gulf from its station near the Strait of Hormuz does not mean France intends to escort French ships in the waterway. Although France maintains a small number of warships in the region, it has refused to join the Reagan administration's plan to escort Kuwaiti merchant ships as part of a U.S. effort to keep the gulf open to navigation despite the Iran-Iraq war.

The incidents nevertheless dramatized the seriousness of a conflict that became evident when heavily armed French police ringed the Iranian Embassy here June 30 and began identification checks of all those entering and leaving the building. The Interior Ministry said the police were seeking Wahid Gordgi, an embassy official summoned for questioning over his suspected links to terrorists who set off a series of bombs in Paris last fall.

Gordgi, listed by the embassy as a translator, has remained holed up inside the building behind a shield of diplomatic privilege while Paris and Tehran exchange increasingly angry statements on the standoff. Even before today's escalation, the dispute appeared to have seriously damaged Prime Minister Jacques Chirac's attempts to normalize relations with Iran as a way to improve chances for liberating French hostages in Lebanon.

The setback, even if it proves only temporary, has demonstrated that dealing with the revolutionary Islamic leadership in Tehran is as difficult and unpredictable in Paris as it is in Washington. Unlike the Reagan administration, however, Chirac's efforts to forge links with Iranian officials were carried out in the open, reducing the political cost of reversals such as the present crisis.

According to agency dispatches from Bahrain, the container ship was attacked early this morning by two small gunboats using heavy machine guns and rocket-propelled grenades. Capt. Max Gangneur told reporters telephoning from shore that the container ship was hit in the middle of the hull and its engine room and electrical system damaged.

The incident occurred about 40 miles east of Saudi Arabia's Ras al-Safaniyeh oil terminal, where the Ville d'Anvers was sailing after unloading cargo in the Kuwaiti port of Al Shuaiba, he said in the ship-to-shore conversations.

The French Foreign Ministry issued a communique tonight deeming the attack "a serious affair" and demanding "official explanations from the Iranian state."

More than 300 merchant craft have come under attack from Iranian or Iraqi planes and ships since 1981 in what has come to be called "the tanker war." The Ville d'Anvers was the fourth French vessel attacked as a result of the Iran-Iraq war, but the first hit by fire from the small gunboats operated by Iran, according to records cited in the French press. France has been an important supplier of arms to Iraq.

The Iranian warning to France came in a broadcast on Tehran's official radio commenting on the diplomatic incident yesterday in Geneva. The broadcast said Mohsen Aminzadeh, an attache at the Iranian Embassy here, was the victim of "a savage attack" by the "fascist French police" in the French part of Geneva's international airport, which straddles the border between France and Switzerland. The Islamic Republic "warns France against the disastrous consequences of this attitude," it said.

A spokesman at Geneva Cantonal Hospital said Aminzadeh, 28, suffered light injuries, agency reports said. They quoted French officials as saying Aminzadeh hurled himself to the floor after customs agents insisted on inspecting his personal luggage as he sought to board a Paris-bound flight.