NICOSIA, Cyprus (AP) _ Iranian President Hashemi Rafsanjani promised help to free Western hostages in Lebanon provided the United States improves relations with his country, and he cited frozen Iranian assets as one sore point.

''I have said many times that if the United States expects us to help in the Lebanese issue, it should show in practice that it has dropped its hostile stand against us,'' he told Pakistan's foreign minister after being sworn into office Thursday before Iran's Parliament.

The official Islamic Republic News Agency quoted Foreign Minister Yaqoub Khan of Pakistan as saying he had been asked to seek Iran's cooperation in freeing the 16 hostages, who include eight Americans. Most are held by pro- Iranian groups.

Rafsanjani indicated it could be some time before there could be any accommodation on the hostage issue, according to IRNA, monitored in Nicosia.

''If the Americans really do have good will, it must take a very long time before this good will can be proven in practice,'' he said.

Rafsanjani said Washington had shown hostility toward Iran by freezing billions of dollars in Iranian assets and by supporting Iraq in its eight-year war with Iran.

On Sunday IRNA said Iran would ''use its maximum influence for the release of all the hostages'' if the United States freed $2 billion in Iranian assets. The assets were frozen 10 years ago after Iranians seized the U.S. Embassy in Tehran and held 52 Americans hostage for 444 days.

But in what appears to be a continuing power struggle between hard-liners and pragmatists, Iran's spiritual leader Ayatollah Ali Khamenei said Monday that there would be no dealings with the ''cursed'' United States.

At the swearing-in Thursday, Rafsanjani pledged to use the increased powers of the presidency to avoid political strife, but he acknowledged that political infighting has undermined efforts to form a Cabinet.

Rafsanjani, a middle-ranking clergyman, took over from Khamenei, who was elected the Islamic republic's supreme spiritual leader after the death of Ayatollah Ruhollah Khomeini on June 3.

The new president leads the so-called pragmatists in Iran, who favor improving relations with the West to gain technology and financing for rebuilding an economy devastated by the Iran-Iraq war.

The rival radicals, headed by Interior Minister Ali Akbar Mohtashemi, advocate strict controls on economic and social activity and an anti-Western foreign policy to keep the 1979 Islamic revolution on track.

Rafsanjani was sworn in seven weeks early so that he can tackle pressing problems that include shortages, soaring inflation and widespread unemployment.

The Western hostage held longest in Lebanon is Terry Anderson, chief Middle East correspondent for The Associated Press. He was kidnapped March 16, 1985.