NICOSIA, Cyprus (AP) _ Two years after he was elected Iran's president, Hashemi Rafsanjani and the Islamic Republic are at the crossroads.

Either Rafsanjani, leader of the so-called pragmatists trying to end Iran's isolation, will turn the moribund economy around before the 1993 presidential election or the country will face the prospect of sliding back into turmoil.

If Rafsanjani cannot subdue his radical rivals and the deeply entrenched conservatives to revitalize the economy, ''the alternative would most likely be a sustained period of instability,'' said Shireen Hunter of Georgetown University's Center for Strategic and International Studies.

Rafsanjani was elected July 28, 1989, seven weeks after the death of Ayatollah Ruhollah Khomeini, founder of the Islamic Republic.

Despite predictions of a violent power struggle, the transition was surprisingly smooth. But deep-rooted rivalries, which Khomeini kept in check by his undisputed authority, remain to haunt his heirs.

Khomeini's death and a national referendum that gave unprecedented powers to the presidency allowed Rafsanjani to steer Iran onto a new course, away from the rigid Islamic constraints imposed by Khomeini and toward a more open society.

Shortly before his election, he stressed with a candor that at the time was surprising: ''It is impossible in today's world to be totally independent.''

To the radical, anti-Western fundamentalists, who consider themselves Khomeini's true heirs, this is anathema. Anything that penetrates the hermetic Islamic shield Khomeini built around Iran dilutes the revolution, they argue.

Rafsanjani, 58, has contained his rivals and pressed ahead with his drive to open up relations with the West to attract badly needed foreign investment and access to advanced high technology to galvanize the oil-based economy.

But he has not eliminated them. He has moved many out of positions of power, but they remain within the bloated bureaucracy, eager at every turn to sabotage Rafsanjani's efforts.

''If internal bickering continues, and recent reforms remain unfulfilled, Iran faces an uncertain future and some of the pessimistic predictions made at the time of Khomeini's death may yet come to pass,'' Hunter said.

Rafsanjani has succeeded in loosening some of the rigid Islamic restrictions imposed by Khomeini and divesting Iran of its extremist ideology, much to the fundamentalists' chagrin.

But he ''hasn't been as successful in domestic policy as much as in foreign policy,'' said Morteza Firouzi, political editor of the Tehran Times, Iran's leading English-language daily.

Under Rafsanjani's guidance, Tehran has restored relations with Britain, Saudi Arabia, Jordan and other states.

Rebuilding bridges with the United States, which broke off links in 1979, remains a distant prospect while Americans and other Westerners remain held hostage in Lebanon by pro-Iranian extremists.

During the 1990-91 Persian Gulf crisis, Rafsanjani succeeded in keeping Iran neutral, despite radical pressure to side with Iraq against the American troops based in Saudi Arabia. He emerged with his credibility at home and abroad enhanced.

But he still faces major problems that must be overcome swiftly.

Central to this is getting the economy on its feet again after more than a decade of internal upheaval, abysmal mismanagement by Islamic zealots and the 1980-88 war with Iraq.

Foreign economic analysts conservatively estimate that the economy needs a $100 billion overhaul.

Iran's population is growing at a rate of 3.9 percent a year, one of the highest growth rates in the world. Since the revolution, it has swelled from 37 million to an estimated 58 million. By the year 2020, unless the birthrate is slowed, it will reach some 140 million.

Unemployment, currently running at an estimated 25 percent, will become a grievous problem. Even now, every year thousands of university graduates cannot find even menial jobs.

The government insists it has reined in double-digit inflation to ''only 8 percent,'' and that the economy has grown by an unprecedented 10.1 percent.

But those figures mean little to people whose buying power is less than it was in 1979, with prices moving up all the time.

Officials admit privately that the system is burdened by nepotism and corruption, which the government has been unable or unwilling to stamp out.

But most agree that Rafsanjani's outward-looking policies rather than the radicals' xenophobic fundamentalism is Iran's only hope for progress.

Rafsanjani is likely to have to put that to the test next spring when elections for the 270-member Majlis, or parliament, are due.

Radicals dominate the Majlis. They have stalled Rafsanjani's 1990-95 development plan, cornerstone of his economic strategy, and regularly snipe at the technocrats in his government.