Unidentified attackers threw grenades into a crowded mosque in Iran's southwestern port city of Khorramshahr today, killing at least six people and injuring about 60 others who were attending a mourning ceremony for a slain Islam Revolutionary Guard.

In swift retribution, three men were executed in Khorramshahr tonight after being blamed for the attack.Two of them had Arab surnames. Survivors of the attack had immediately pinned responsibility on local Arabs demanding autonomy for Iran's main oil-producing province of Khuzestan.

The mosque bombing, one of the ugliest incidents since fighting erupted between Iranian Arabs and Persian supporters of Ayatollah Ruhollah Khomeini at the end of May, quickly led to further violence.

As some units of Khomeini's Revolutionary Guards patrolled the streets of Khorramshahr, other attacked the home of the Arab community leader, Ayatollah Mohammed Taher Shobeir Khaqani, in apparent revenge for the mosque bombing.

According to witnesses, the guards killed at least three people after entering the house in an assault launched from surrounding streets and across the rooftops of neighboring houses. Khaqani's whereabouts were not immediately known.

Khorramshahr's governor, Mohammed Alavi, later said the guards had gone to Khaqani's home to provide protection for the 72-year-old Moslem religious leader.

Political violence also returned to the streets of the capital today with an attempt to assassinate Ayatollah Razi Shirazi, head of a revolutionary committee in north Tehran and reportedly a close associate of Khomeini.

Two men riding a motorcycle shot and wounded the ayatollah in the hand and legs as he emerged from a mosque where he had been attending midday prayers.Shirazi was reported in satisfactory condition. His attackers escaped.

Militiamen of Shirazi's committee later fatally shot a motorcyclist who failed to heed their orders to halt outside their headquarters.

Following the attack in Khorramshahr, Khuzestan's governor general, Adm. Ahmad Madani, traveled to the city later in the day to investigate the trouble.

Madani has taken a tough stance on Arab demands for local autonomy. The Arabs have also charged him with failing to check the aggressive intervention in local affairs of the revolutionary committees and, more recently, the Revolutionary Guards, an elite commando force.

Although backed by the clergy-dominated Revolutionary Council against Arab demands for his dismissal, Adm. Madani is not believed to have much control of the Revolutionary Guards, who answer only to Khomeini and the council.

Madani has been forced to rely on the guards increasingly for security duties which some Army units on the spot have refused to carry out - well aware that soldiers who obeyed the shah's officers in similar situations are still being tried and executed.

One of the main concerns of Madani and the government has been to prevent sabotage, which threatens vital oil installations concentrated in the province. Two days ago the governor general warned that Revolutionary Guards would act with "utmost strength and severity" against anyone suspected of intent to commit sabotage.

In contrast to developments in Khuzestan, the Kurdish town of Marivan was reported quiet today after a shootout between residents and Revolutionary Guards Saturday in which 24 persons were officially reported killed.

The government flew as many as 150 troops to the nearby town of Sanandaj but has so far refrained from sending them to Marivan, now said to be under Kurdish control.

Meanwhile, a revolutionary tribunal in Tehran has started the trial of former health minister Shojaeddin Sheikholeslamzadeh, one of the last of the shah's ministers awaiting judgment after the execution of more than 330 people since the February revolution.

The former minister was arrested on corruption charges weeks before the shah went into exile. But the charges against him now also list cases of adultery, setting up a brothel and marketing heroin on behalf of the shah's twin sister, Princess Ashraf.

One of the charges against the minister that could carry the death penalty is that he created conditions in which Iranians were unable to obtain medicine, causing the deaths of hundreds.