Vowing that terrorism will not deter Iran's "march forward," Ayatollah Ruhollah Khomeini today denounced the assassination of a leading member of his Revolutionary Council and declared Thursday a national day of mourning.

The architect of Iran's new Islamic republic called the murder late Tuesday night Of Ayatollah Morteza Motahari "a great shorck for Islam." In an emotional speech, Khomeini said he would personally mourn Motahari for two days at the Theological institute in the holy city of Qom, Where he resides and where Motahari is to be buried Thursday.

The little-known member of Iran's shadowy but powerful Revolutionary Council was gunned down on a Tehran street after leaving a house where he reportedly met with Prime Minister Mehdi Bazargan.

Thousands of demonstrators, many demanding revenge, marched to Khomeini's house in Qom today to protest the murder. Most shops and offices there closed. Similar demonstrations and strikes were held in a number of other cities throughout the country.

But it was obvious that the assassination, claimed by a mysterious terrorist group called Forqan, struck a responsive chord among some radical, and even liberal, students, youn people and middle class citizens who resent the growing domination of the country by the right-wing Shiite Moslem clergy.

Forqan earlier claimed responsibility for the April 23 assassination of the new government's former military chief of staff, Gen. Mohammed Vali Gharani, who was forced to resign a month earlier under criticism for the Army's handling of Kurdish autonomists.

After that murder, the group cited the "dictatorship of the mullahs," or Islamic prayer leaders, and alleged supprression of Iranian Kurds among a list of reasons for the act.

In an anonymous telephone call to a Tehran newspaper late yesterday, a man said, "In the struggle against mullahism we assassinated Morteza Motahari, the head of the Revolutionary Council."

The official Pars news agency today confirmed that Motahari was a member of the secretive Council, without mentioning whether he actually headed it. The Council - understood to make all major decisions for the government, especially concerning national security and revolutionary trials - answers only to Khomeini. Whether Khomeini ranks as a member of the Council, or holds a position entirely above it, has never been revealed.

Motahari's death marked the first assassination of a senior anti-shah religious leader since the struggle to depose the monarchy began more than a year ago. It was also the hardest blow against Khomeini's inner circle since agitation against his strict Islamic style started shortly after the February revolution.

There were conflicting accounts of the assassination, but it was generally agreed that Motahari died of a single bullet through the head, evidently fired at close range from a handgun. Some reports said two attackers were involved.

At the time of the shooting, shortly before 11 p.m., Motahari was leaving the home of Yadollah Sahabi, the minister of state for revolutionary projects. According to a clergyman quoted by the state-run radio, the ayatollah had just been meeting there with Sahabi and Bazargan.

In another development, militiamen used tear gas and automatic weapons to subdue rioting inmates at Tehran's central prison. Guards said the prisoners were all common criminals, although other reports said former SAVAK agents and political offenders were also kept in the jail.

Like the murder of the Gharani last month, the latest assassination claimed by Forqan appeared to be the work of gunmen who carefully planned their attack, executed it with precision, then fled. In the view of some observers here, that seemed to point to either SAVAK agents or trained urban guerrillas, perhaps an offshoot of one of the mainstream Islamic or leftist guerrilla organizations.

The Islamic Mujaheddin and the Marxist Fedaye guerrilla groups both issued statements today condemning the murder.

In a capital where rumors often take on a life of their own, reports of a Forqan hit list aroused intense speculation about a wave of terrorism against the more unpopular officials of Khomeini's government.

Often singled out for criticism lately have been Ibrahim Yazdi, who recently assumed the post of foreign minister after giving up his powerful position as deputy premier for revolutionary affairs; Sadegh Ghotbzadeh, the head of the National Iranian Radio and Television; and Abol Hassan Bani-Sadr, an economic adviser to Khomeini. All three spent years in self-imposed exile before returning to Iran with the ayatollah.

Little is known about Forqan, which takes its name from a Koranic term meaning "holy book" or "the difference between truth and falsehood." The group had not been heard of here before the assassination of Gharani.

Political assassination has a long history in Iran. Perhaps the most notorious killers were the members of a fanatical sect of Islam established in the remote hills and valleys around Qazvin, a city northwest of Tehran. Led by the legendary "old man of the mountain" described by Marco Polo, the sect terrorized rulers and political leaders throughout the Moslem world in the 11th and 12th centuries.

The members became known as "hashashins," whence the English word assassins, because their master intoxicated them with hashish and sent them off to murder kings and princes. CAPTION: Picture, Ayatollah Morteza Motahari, a key Iranian mullah and Khomeini aide, who was assassinated yesterday.