TEHRAN, JAN. 16 -- Iranian President Ali Akbar Hashemi Rafsanjani told visiting Libyan officials today that Iran is willing to fight to defend the interests of Islam, and he condemned the presence of "imperialists" near Moslem holy places in the Persian Gulf region.

Speaking hours before U.S. and allied warplanes began attacking strategic sites in Iraq and Iraqi-occupied Kuwait, Rafsanjani said that Iran was monitoring developments in the area and expressed hope that Islam would "rid the region of the domination of arrogance." Neither Rafsanjani nor other officials quoted in official media reports were more precise about Iran's intentions.

Earlier, Maj. Abdul Salam Jalloud, Libya's second in command after Col. Moammar Gadhafi, said in a meeting with Iranian leaders that he believed "infidel" foreign forces massed against Iraq would trigger a Moslem holy war to defend Islam's holy sites. In a report carried on Tehran radio, Jalloud said: "So long as the forces of blasphemy are in Saudi Arabia and the land of Islam is impure, the {Moslem annual pilgrimage to Mecca} will not be permitted." Mecca and Medina, both in Saudi Arabia, are Islam's two holiest sites.

Mahdi Karubi, speaker of the Iranian parliament, said at the same meeting that the foreign presence in "the land of divine revelation" was "the biggest humiliation" for Islam and that the world's Moslems would "foil their enemies' plots."

Tehran has also criticized Iraq's invasion of Kuwait, and it has pledged to remain neutral if war broke out.