Iran put its Army on "full alert" today, charging that Iraq, at the prompting of the United States, had attacked an Iranian oil facility and a police headquarters near their common border.

Iran's official Pars news agency said about 70 Iraqi commandos with mortars and rocket-propelled grenades launched the attack before dawn today in Kermanshah Province in western Iran. No casualties were reported but Oil Minister Ali Akbar Moinfar said the attack cut the flow of oil from the Kermanshah refinery, a major installation.

Iran's official radio also said that "aggressors" had occupied Iranian territory in another portion of the border region but were repulsed by Revolutionary Guards. One Revolutionary Guard was killed and 11 wounded, the radio said.

As relations between the two Islamic neighbors continued to deteriorate, Iranian authorities said Iraq was expelling thousands of Iranians after subjecting some of them to beatings. They also charged that Iraqi agents had arrested an Iranian ayatollah in the Iraqi holy city of Najaf, here Ayatollah Ruhollah Khomeini lived in exile before being expelled by Iraq.

In Tehran, several thousand Iranians marched in front of the Iraqi Embassy in an officially inspired demonstration to protest Iraq's alleged mistreatment of Iranian residents.

Relations between the two countries, tense since the overthrow of the shah of Iran last year, became markedly hostile last week when Iraq blamed Iran for the attempted assassination of Iraqi Deputy Prime Minister Tariq Aziz in Baghdad.

The attacker, who was killed by security agents, was identified by Iraq as an Iraqi resident of Iranian descent.

Both Iranian Foreign Minister Sadegh Ghotbzadeh and Iran's military chief-of-staff, Maj. Gen. Hadi Shadmehr, accused Iraq today of acting on behalf of "American imperialism" in its recent alleged provocations.

"The criminal Iraqi government is increasingly controlled by American imperialism and international Zionsim," Ghotbzadeh said in a broadcast. "If the government of Iraq wants to commit acts of provocation and treason, we will face up to them."

He quoted Khomeini as urging Iranians to "stand firm in the face of Iraq."

Shadmehr, asserting that the Iranian army is always on alert, added:

"Especially now that Iraq, provoked by American imperialism, has stepped up its threat, violations and sabotage, this state of alert has been intensified and at the moment Iran's Islamic republican armed forces are on full alert."

All leaves for the armed forces have been canceled, Shadmehr said.

Iraq's move to expel Iranians from its territory apparently came in retaliation for the attack on Ariz and a weekend grenade attack in Baghdad in which one Iraqi was killed and an Iranian was arrested.

Another bone of contention between the two countries has been Iraq's demand that Iran withdraw from the disputed and strategically situated Persian Gulf islands of Abu Moussa and the Greater and Lesser Tumbs. The shah's armed forces seized the small, sparsely populated islands in 1971 after the departure of British forces from the region.

Arab countries along the Persian Gulf claim that the islands are Arab territory. They are in the Strait of Hormuz, through which two-thirds of the world's oil exports pass on their way out of the Gulf to foreign markets.

Iran's revolutionary leader, Khomeini, has not forgotten his expulsion from Najaf by Iraqi authorities at the urging of the shah in the fall of 1978 when Khomeini's movement was gathering steam.

After Khomeini came to power, Iraqis resented what they saw as Iranian efforts to stir up Iran's Shiite Moslems against the dominant Sunni Moslem sect. Many Iraqi Shiites are believed to sympathize with Iran's Shiiteled revolution.