Abdurrahman Wahid, leader of Indonesia's largest Muslim organization and a potential kingmaker following last week's parliamentary election, is in a joking mood. He tries this one on a visitor to his office:

Indonesia's first president, Sukarno, was crazy about women, he says. The second president, Suharto, was crazy about money. Now, the third president, incumbent B.J. Habibie, well, he's just crazy. And then Wahid, fondly known here as "Gus Dur," laughs uproariously at his own humor.

Wahid prides himself on his love of jokes -- matched only by a fondness for classical music. When Suharto was still in power, Wahid had a book of Soviet Union-era jokes, called "How to Die Laughing the Russian Way," translated into Indonesian -- a subtle way to get Indonesians to make fun of their own authoritarian government. With Gus Dur's humor-laced introduction, it became a bestseller here.

Jokes, he said, are how he defuses tension and deals with troublesome problems. And today he finds himself with a large dose of each, as he grapples with a dilemma requiring all the humor he can muster. The question is who should be Indonesia's next president, and Wahid, 59, with a pivotal role to play, is in a bind.

Wahid has formed a loose alliance with the popular opposition leader, Megawati Sukarnoputri, whose Indonesian Democratic Party of Struggle is far in the lead, according to a partial vote count. But Megawati is far short of a majority, and she needs Wahid, and the votes of his newly formed National Awakening Party to dominate the new parliament and have a shot at the presidency. The National Awakening Party is in third place, according to the unofficial returns.

But Wahid is facing dissent in his ranks. Some strict Muslims believe the idea of a woman serving as president violates Islam. Others are upset that many of Megawati's candidates for parliament are Christian in a country where 90 percent of the population is Muslim. A few are clamoring for Wahid to run for the presidency himself.

Wahid has to decide what to do. His choice will likely be crucial in determining whether Megawati, the daughter of Sukarno, the country's founding father, can ascend to the presidency.

"If we deny Megawati the presidency, then there will be riots, because her followers are very rough," Wahid said, as the interview in his office turned from jocular to deadly serious. "They can do bad things."

"But if we take her, the Muslim rightists are also very rough. There will be rioting as well."

Wahid believes Megawati made a crucial mistake in forming a list of parliamentary candidates heavy with Christians, thereby giving her Islamic critics an opening. Her "image now is that she is not pro-Islam," he said.

There is also the gender problem. Wahid said some of the Muslim clerics who will have seats in the incoming parliament "will object to her on these grounds."

He said he is likely to endorse Megawati, but leave it up to his party members in parliament to make their own decision.

"Even I cannot guarantee my followers will follow me," he said.

Megawati's aides said they have made no decisions on coalition partners. But few believe Megawati could get a majority in parliament without Wahid and his party.

Wahid admits to his own doubts about whether Megawati has the intellectual capacity to lead the country at a time of economic crisis and political transition.

"Whether she is presidential timber or not, we don't know," he said. "Although she is stupid, she loves people."

Remarks like that seem unlikely to endear Wahid to Megawati. But Wahid said they are like brother and sister. He met with Megawati last weekend and warned her that he might not be able to commit his party's votes to her. But in general, he said, he tried to keep their conversation light.

Wahid said he repeated his line about Megawati being stupid, but there was no animosity. "I think she thinks about her own limitations," he said. One way out of the current dilemma, he said, would be for Megawati to take herself out of the running.

The problem is that there are few acceptable alternatives either to unify the disparate elements of the Islamic camp or to satisfy Megawati's followers who are hungry for political change.

One candidate is the outspoken Muslim scholar Amien Rais, whose newly formed National Mandate Party appears to be faring poorly in the balloting, in fifth place so far with about 7 percent of the vote. Until he stepped down to lead his party, Rais headed Indonesia's second-largest Muslim group, Muhammadiyah, a longtime rival to Wahid's larger group, Nahdlatul Ulama.

Wahid is particularly disparaging about Rais, saying, "We look at Amien Rais and we see how distorted his mind is. . . . He doesn't know anything about the world."

And he has even harsher words for the incumbent, Habibie, candidate of the ruling Golkar party, which is heading for defeat for the first time in 30 years. Asked if Habibie might emerge as the compromise candidate, Wahid said, "No, no. First of all, Habibie doesn't have political sense, or a sense of politics. Because of this, the whole nation despises him."

The lack of alternatives leave many analysts guessing that in the end, most members of the National Awakening Party will reluctantly back Megawati.

Wahid said he may allow his name to be put up as an alternative presidential candidate, if only because his followers might insist there is no other choice. "In the end, maybe it will go to me," he said. "And I don't like it."

How does he maintain such good rapport with Indonesia's feuding politicians, even while offering sometimes blunt commentary on their skills? "By staying honest with them," he said. "The most important thing is honesty. And jokes. Many jokes."

CAPTION: Abdurrahman Wahid, leader of a new party, could be a kingmaker.