Thousands of Iranian Arabs demonstrated in the southwestern port city of Khorramshahr today in support of an Arab religious leader who has threatened to leave the country to protest excesses in the new revolutionary government.

Ayatollah Mohammed Taher Khaqani has said he would leave to protest the government's treatment of his followers and the behavior of Ayatollah Ruhollah Khomeini's revolutionary committees.

[Thousands of Iranians also demonstrated in the holy city of Qom in support of the moderate religious leader, Ayatollah Kazem Shariatmadari, United Press International reported.]

The demonstration in Khorramshahr coincided with a visit to Tehran by a delegation of Iranian Arabs demanding regional autonomy under a federal system. The group, which claims to represent more than 2 million Arabs in Iran's southwestern oil-producing region, is due to meet Prime Minister Mehdi Bazargan shortly to discuss the inclusion of autonomy provisions in the new Iranian constitution.

Regional autonomy demands by minority groups, including Arabs, Kurds, Turkomans and Baluchis, have delayed the publication of the draft constitution.

In the oil-refining center of Abadan, Iranian leftists demonstrated against the arrest this week by Islamic militiamen of 41 members of a Marxist guerrilla group. A government spokesman has charged that the guerrillas were trying to buy arms to stir up a leftist rebellion among the Turkomans of northeastern Iran near the Soviet border.

Meanwhile, Iran's provisional revolutionary government distanced itself from the Communist government in neighboring Afghanistan today, while drawing closer to Libya's radical Arab republic.

Following meetings between Libya's visiting number two man, Abdosalam Jalloud, and Iranian leaders, the Foreign Ministry announced that Prime Minister Bazargan has accepted an invitation to visit Libya "in the near future."

The acceptance and the Foreign Ministry statement appeared to indicate that, despite outstanding differences over the disappearance of a prominent Shiite Moslem leader during a trip to Libya, the Iranian Islamic republic is willing to align itself with Libya's brand of Islamic extremism.

This would amount to a significant shift in foreign policy under the new foreign minister, Ibrahim Yazdi, compared to the more moderate approach of his predecessor, Karim Sanjabi, who resigned earlier this month.

The Foreign Ministry also issued a separate statement "strongly deploring" accusations by the president of neighboring Afghanistan of Iranian involvement in a rebellion by Afghan Moslems against Kabul's Communist government.

The statement denied any interference in Afghanistan's internal affairs, although it acknowledged that reports of mistreatment of religious leaders in Afghanistan had angered Iranian moslems and clergymen.