Serious clashes in northwestern Iran between rival ethnic, religious and political groups put new strains today on Iran's harried provisional government as Ayatollah Ruhollah Khomeini warned of a national "danger" from leftist "devils."

The fighting in the Azerbaijan province town of Naqadeh, inhabited by Kurdish, Turkish and Persian-speaking Iranians, has claimed as many as 30 lives, according to reports from the scene.

In a separate incident in the south-western oil-refining center of Abadan, Moslem militants loyal to Khomeini attacked the headquarters of a Marxist guerrilla organization, reportedly injuring several members and seizing about 30.

The trouble in Naqadeh and Abadan started Friday after an apparent compromise between Khomeini and a more liberal religious leader, Ayatollah Mahmoud Taleghani. Their agreement defused agitation against Khomeini's revolutionary committees by Iranian liberals and both Marxists and radical Islamic guerrilla groups.

According to residents, the violence in Naqadeh erupted when a meeting of a militant branch of the Kurdish Democratic Party came under fire.

In any case, the incident escalated into a full-scale battle after the well-armed Kurds shot back. Reports from Naqadeh said Turkish-speaking Azerbaijanis and Persian-speaking Iranians from the Khomeini committees joined the fight against the Kurds.

Witnesses reported seeing bodies lying in the streets of the town today as the fighting continued. At least one cease-fire was declared and quickly broke down, and local religious and political leaders were working on a new one.

The official Pars news agency said tonight that 15 people had been killed and 50 injured in the Naqadeh clashes by 11 this morning.

In addition to its ethnic aspect, the battle has political overtones because the Kurdish Democratic Party faction that came under attack is a leftist socialist-oriented group reviled by the conservative Moslems loyal to Khomeini. The fight has religious elements because the Kurds are mostly Sunni Moslems while the Azerbaijanis and Persians are predominately of the Shiite majority.

The conflict may also have the ingredients of a fratricidal border feud. There were unconfirmed reports that a more conservative wing of the party originally based in neighboring Iraq joined the fight against their leftist rivals.

The Iranian party tonight blamed the fighting in Naqadeh on "feudalists," a term the group has used to describe the clannish Iraqi branch of the party.

A statement by the Iranian party also accused its attackers of being "in league with the shah's supporters."

In Abadan, the headquarters of the Marxist Cherikhaye Fedaye, Khalq guerrilla organization came under attack by a mob of club-wielding Moslem militants following a demonstration in the city to protest unemployment.

The attackers accused the guerrillas of trying to take advantage of the unemployment problem to promote their goal of a communist society in Iran.

Fedaye members and sympathizers in Tehran complained that when militiamen from Abadan's revolutionary committees came to restore order, they began arresting the leftist guerrillas.

Fedaye supporters in Abadan were reportedly staging a sit-in outside the offices of Khomeini's committee to demand the release of their comrades, and guerrilla leaders in Tehran were busy meeting on what to do about the situation.

It was the arrest in Tehran of Ayatollah Taleghani's two sons and a daughter-in-law-members or sympathizers of leftist guerrilla groups - which sparked demonstrations earlier this week against the growing power Khomeini's committees.

Taleghani went into hiding in protest before meeting Ayatollah Khomeini in the holy city of Qom Thursday to sort out the problem. In an apparent compromise, Khomeini announced that the committees would be "purged" and new rules would abolish their powers of arbitrary arrest and-searches, while Taleghani went on national television and reaffirmed Khomeini's primacy as the "leader of the Iranian revolution."

Today, however, Khomeini and Taleghani appeared to differ anew in separate speeches in Qom.

Calling Iranian leftists "children of Satan" and "agents of America," Khomeini told an audience of tribal leaders, military commanders and police chiefs that his Islamic republic faced "plots" to ruin the country's economy, army and agriculture.

"You should not let groups of atheists infiltrate your ranks," Khomeini said. "Don't let these people weaken the committees and the Islamic Army.

"I am warning the entire nation that there is a danger. These devils are creating disturbances every day. You must throttle these disturbances."

Taleghani, meanwhile, preached in a Qom speech that Communists should be allowed to compete politically.

"The old regime was afraid of them, but we shouldn't fear them," he said."Communists represent nothing here, but they will emerge from nothing if we oppress them. And we will have given proof of weakness and lack of confidence in Islam." CAPTION: Map, no caption, By Dave Cook-The Washington Post