KOKAND, U.S.S.R. -- Over the past seven decades, the Nuril Islam mosque in this ancient Moslem city was used in turn as a warehouse, a children's bookshop and a teahouse. This year, it reopened for worship -- part of a spectacular Islamic revival in Soviet Central Asia.

"Even the Communists are coming to the mosques these days," said Imam Hatib Kahmetgulov, standing in the shady courtyard of the recently rebuilt mosque. "They thought they could create a godless society. But they discovered that a world without religion is a world without morality."

The past year has witnessed an explosion of religious activity in the predominantly Moslem republics of Central Asia as the Communist state rethinks longstanding ideological dogmas. Along with a recent surge in ethnic violence, the return to Islam is the most dramatic example of the impact of President Mikhail Gorbachev's policies of glasnost and perestroika -- openness and restructuring -- on one of the Soviet Union's most backward regions.

Mosques are being reopened at the rate of almost one a day across Central Asia. Hundreds of students have enrolled in theological colleges. Millions of copies of the Koran and other Moslem works are being distributed. More than 1,500 Soviet Moslems took part in this year's pilgrimage to Mecca, the largest Soviet participation in the hajj since the 1917 Bolshevik revolution.

Here in Kokand, which was the capital of one of three Moslem khanates before its annexation by czarist Russia in the late 19th century, billboards proclaiming a bright communist future are being replaced by signs in Arabic glorifying Islam. The wail of the muezzin summoning the faithful to prayer mingles with the sound of construction work at 14 recently opened mosques. A year ago, a single mosque served a population of nearly 150,000.

During the early years of perestroika, the Russian Orthodox Church was the principal benefactor of the more liberal official policy toward religion. But the Soviet Union's 45 million Moslems -- the most rapidly growing population group here -- now seem poised to take advantage of a new law on religion that obliges the state to reopen places of worship if petitioned by at least 20 believers.

"At first, Moslems were rather passive and did not react quickly to what was happening elsewhere in the country," said Muhammad Yusuf, the grand mufti of Tashkent and the head of the Moslem religious board for Central Asia. "Now we are demanding the same privileges accorded to other religions."

As the Soviet Union's senior Moslem leader, the mufti has worked to rebuild contacts between Central Asia and the rest of the Islamic world. Earlier this month, he was in Libya, attending an international Islamic conference. Libya and other Moslem countries, such as Saudi Arabia and Egypt, have pledged millions of dollars for the construction of mosques and theological colleges in the Soviet Union.

A few years ago, such religious fraternization would probably have alarmed the Kremlin. But the Soviet authorities have encouraged the Islamic revival in Central Asia, granting permits for the opening of new mosques with little difficulty. At a time when Communist ideology is rapidly breaking down, the party seems to see the mufti and other Moslem leaders as important political allies in the fight against crime and moral decay.

"The rise in crime is directly due to the lack of religion," said Shukrullo Yusupov, a prominent Uzbek writer and member of the republic's presidential council. "For years, we taught our people to believe only in what they saw directly. People assume that it's all right to steal something as long as the boss isn't looking. A religious person, on the other hand, believes that God sees everything -- and he will punish you even if your boss doesn't."

In an interview in Tashkent, Uzbek Prime Minister Shukrulla Mirsaidov acknowledged that the state had adopted a "mistaken" policy toward religion in the past. He described the rise in religious activity -- more than 200 mosques have been opened in Uzbekistan alone over the past two years -- as a "positive" phenomenon and evidence of a general move toward "democracy and freedom of conscience."

"We are forced to rediscover our roots because we have been betrayed by our political ideals," said Mohammed Salikh, an Uzbek playwright and opposition member of parliament. "Communism turned out to be a mirage, but people must have faith in something. The moral code by which we lived for all these years has suffered a collapse."

So far, the state seems to have largely succeeded in channeling the Islamic revival in Central Asia through the officially recognized mosques. It is widely assumed that the KGB security police keep close tabs on Moslem leaders, along with representatives of other religions. Appointments to senior positions in the Moslem hierarchy still require tacit state approval.

"The official Moslems pray to Mecca five times a day, but they obey the Communist Party," complained Dadahon Khasonov, a nationalist Uzbek poet and founder of the Islamic Democratic Party. "Islam says that Moslems should serve only God. The mufti serves both God and the party."

Over the past few months, there have been some signs of an internal opposition developing to the mufti. Dozens of dissidents occupied the central mosque in Tashkent last month to call for the mufti's resignation, accusing him of collaboration with the authorities. They were eventually evicted by police. In the Fergana Valley, which extends east from Kokand, a half-dozen imams support the Saudi-based Wahhabi movement, which calls for a return to "pure" Islam.

During ethnic clashes in the Fergana Valley last year, Soviet newspapers reported that green banners were raised praising the late Ayatollah Ruhollah Khomeini of Iran. But local officials and opposition activists say there is little evidence to support allegations that Islamic fundamentalists were behind the disturbances.

"We are not going to take the Iranian road," insisted Khasonov, who is regarded as an extremist by the authorities because of his calls for an independent Moslem state. "There were some things I admired in Khomeini, but he was too cruel, too fanatical. You must remember that the Iranians are Shiite, while we are mainly Sunni. We want to settle all questions in a democratic, peaceful manner."

There also seems little sympathy among Soviet Moslems for Iraqi President Saddam Hussein in his confrontation with the United States. None of dozens of people interviewed during a week-long trip to Uzbekistan expressed support for Iraq's invasion of Kuwait. The presence of more than 100,000 U.S. troops in Saudi Arabia, the site of the Islamic holy places, aroused little passion.

"Soviet Moslems seem to view Saddam as an Arab leader rather than a Moslem leader," said a Western diplomat in Moscow who follows Central Asia closely. "Saddam may be trying to cast his fight against the United States as a religious war, but I don't think that it convinces many people here."

While they clearly have their own religious agenda, the official Moslem leaders have indicated a willingness to cooperate with the authorities. In an interview last week, the mufti accused the government of failing to take vigorous enough action to curb the rising crime rate.

"I would like the authorities to introduce order into this country. Discipline is virtually nil. Theft and robberies are rampant. They must act so as to make this a civilized country," he said.

At the same time, the imams talk as if they have won a historic victory over an old ideological foe. The spectacular collapse of communist ideology and seven decades of state-sponsored atheism has left them in a position to be magnanimous.

"Communism is a castle in the clouds. Even the Communists now recognize this," said one of the mufti's assistants in a tone of quiet triumph. "If your opponent is already falling down, there is no need to kick him so that he ends up in the ditch."