Residents of the port town of Bandar Anzali on the Caspian Sea coast staged fierce attacks on paramilitary Islamic Revolutionary Guards today, leaving several dead on both sides.

Police said up to 10 persons were killed and 40 to 50 injured in the disturbances, which started yesterday as a protest over fishing rights but quickly escalated into a full-scale riot.

Later unofficial accounts, however, said that 13 may have died, including five Revolutionary Guards.

The state radio charged that leftist guerrillas joined in the attacks, but this was not confirmed independently.

Naval units from a base near the town have been ordered in to restore peace by Navy commander Rear Adm. Ahmad Madani on the authority of unofficial head of state Ayatollah Ruhollah Khomeini.

Main roads into Bandar Anzali (formerly known as Bandar Pahlavi) and the neighboring town of Rasht, also the scene of violent disturbances today, have been sealed off, but security forces do not appear to be operating there, local sources reported.

The trouble started yesterday when fishermen attacked the boats of the government-owned Northern Fisheries Co. in protest at a ban on the activities of independent operators fishing for caviar-bearing sturgeon.

The violence erupted when Revolutionary Guards started shooting into a crowd of fishermen who marched on the company's offices, smashing windows and setting fire to the building.

The state radio reported today that the fishermen were backed up by Marxist Fedaye guerrillas, who had been driven underground in August after attacks on their members and offices by hard-line supporters of the Khomeini government.

Further violence broke out today when a crowd marched through the center of the town, reportedly bearing the bodies of some of the previous day's victims.

An attack using rifles and molotov cocktails was launched against the headquarters of the Revolutionary Guard. The attackers set fire to the building after the occupants escaped.

Meanwhile, news services reported these developments:

The fishing dispute and the subsequent rioting apparently were fueled by growing dissatisfaction in Iran over economic ills and the rule of the Moslem clergy. The clashes marked the first time that rioting has flared in central Iran since the revolution. Unrest previously had been confined to border areas where Kurds, Arabs and Turkomans are seeking autonomy from the central government.

In another development, the government said today it had uncovered a plot by Afghanistan to assassinate Iran's second-ranking ayatollah, Kakzem Shariatmadari, because of his support for Moslem rebels fighting the pro-Soviet government in Kabul.

A Foreign Ministry spokesman said four Afghans were involved in the plot, one of whom had been arrested and confessed. The spokesman confirmed a report by a clergy-controlled newspaper saying that the plot was devised by the late Afghan president, Nur Mohammed Taraki, and continued by his successors.

An Afghan Embassy spokesman said the allegations were entirely false.

In the troubled Kurdish region, rebels released a government emissary after holding him for two days of peace talks with Kurdish leaders, the official Pars News Agency said.

The representative of Prime Minister Mehdi Bazargan, sent to Iranian Kurdistan on a fact-finding mission, said after his release that he was optimistic a political solution to the problem now could be reached.