Ayatollah Ruhollah Khomeini, the Iranian leader, vowed today to continue the war with Iraq "until the infidels are defeated" and said that although many Iranian youths have been killed in the seven-week-old conflict, "this is for Islam."

Khomeini's defiant call for continued fighting, in a speech to clergymen in Tehran broadcast on the official radio, seemed to be a direct response to a speech yesterday by President Saddam Hussein of Iraq offering an early end to the war, but pledging to keep fighting indefinitely unless Iraq's "national rights" are recognized.

With both leaders thus proclaiming their determination to continue the war until the other gives in, they seemed to have reached a total impasse that promised a long and costly war of attrition with no end in sight.

So far, mediation efforts by the United Nations Security Council, the non-aligned nations and the Islamic Conference have all failed. Saddam Hussein has said recently to would-be mediators from all these groups that he would accept a cease-fire if only Iran would, too. Khomeini, however, has insisted that there can be no question of a cease-fire or any negotiations so long as Iraqi troops remain on Iranian soil.

The Security Council approved a plan Wednesday to send a special representative to Iran and Iraq to seek an end to the war.

[After a week of closed-door consultations, the 15-member body unanimously authorized a cautiously worded statement supporting Secretary General Kurt Waldheim's plan for sending a council representative to Baghdad and Tehran "to facilitate authoritative communication with and between the two governments."]

In his speech today, Khomeini returned to this theme, to the apparent delight of his audience. Chants of Allahu Akbar," or "God is Great," were clearly audible over the radio as Khomeini told the visiting Shiite Moslem clergymen at his Tehran residence:

"There should be no compromise with the invaders. Commanders of the armed forces and the Revolutionary Guards of Islam should fight on until the infidels are defeated."

His speech marked the beginning Saturday of the Shiite holy month of Moharram, which commemorates the death centuries ago of the Imam Hossein in a battle with Sunni Moslems in what is now Iraq. Hossein was the grandson of the founder Shiism, Iran's predominant Moslem sect, and the imminent holy month underlined the ancient roots of Iran's conflict with the Sunni Moslem rulers of Iraq.

With the war completing its 46th day, the confrontation also appeared stalemated on the ground. Observers here said both sides seemed prepared to continue fighting in Khuzestan Province into the winter. The Iraqi forces, which have occupied vast tracts of the flat Khuzestan plain, appear to have advanced as far as they can before facing much harder resistance from the Iranians, whose main defenses are believed to be in the foothills of the Taurus Mountains that rise behind the plain and defend approaches to the interior of Iran.

Iraq has shown every sign that it is prepared to settle in for a long time in Khuzestan, rapidly trying to build all-weather roads across its lines of advance on the Khuzestan plain before the approaching winter rains turn its dirt tracks into impassable marshes.

Behind every advancing column of tanks and armored cars have come fleets of bulldozers and steamrollers to ensure Iraqi logistical lines in the winter season.

In another possible sign of resolution for a long war, President Valery Giscard d'Estaing of France conferred with Deputy Prime Minister Tareq Aziz of Iraq, a key aide to Saddam Hussein on his second visit to Paris since the fighting broke out. His stop in the French capital came against a background of reports that France, a traditional arms supplier to the Iraqis, has been selling them a variety of military items in recent weeks and is negotiating for additional sales of HOT antitank missiles and delivery of 60 Mirage F1 warplanes already on order.

Troops deep inside Khuzestan Province continued to lay seige to its major cities of Ahwaz, Khorramshahr and Abadan, all of which have been surrounded and pounded relentlessly by Iraqi artillery fire since the war began.

An Iraqi communique today claimed that at least 100 Iranian defenders in Abadan had been killed or wounded. The Iraqis said only five of their soldiers were killed in the last 24 hours of fighting.

Saddam Hussein, in his speech before Iraq's National Assembly yesterday, made it clear that Iraq lacks neither war material nor money and is thus prepared for a long, drawn-out war until Iran recognizes its claims. Although the Iraqi leader did not reiterate these claims, Iraq has consistently demanded that Iran recognize Iraqi sovereignty over the Shatt-al-Arab waterway and agree to territorial adjustments along its borders.

At the beginning of the war, Iraq also demanded that Iran return to Arab sovereignty three small islands at the mouth of the Persian Gulf taken by the late shah, Mohammad Reza Pahlavi, in 1971. However, in the past month, that demand has not been reiterated as a major concern.

Saddam Hussein said that if Iran would agree to these claims, Iraq is prepared to withdraw its armed forces from Iranian territory immediately, even "tomorrow."

However, in the same breath he warned Khomeini that the war itself imposes "its own demands" beyond those that originally led Iraq to attack Iran.

The Iraqi president did not elaborate on what these possible new claims might be, but diplomats in Baghdad speculated that they might herald an Iraqi effort to set up Iran's Khuzestan Province, long considered an Arab land by Iraq, as some sort of autonomous province ruled by its Arab inhabitants rather than the Persian leaders in Tehran.