Events have done for the Shah of Iran something he himself - with all his power and oil and wealth - could never have done. They have made the case for his regime.

Internal troubles demonstrate that the shah is basically a modernizer whose opposition centers around be-nighted Islamic fundamentalists. The visit to Iran of China's leader, Hua Kuo-feng, underlines the crucial role of the shah in great-power politics.

By no mere accident, internal problems have come to a head during the past month. For this is the time of Ramadan, the Moslem holy month, when abstinence from food, liquor and amusements is enjoined. As a protest against the wholesale violation of religious tradition, Islamic fundamentalists have been staging demonstrations, marches and riots in Tehran, Isfahan, Kum, Meshed and many other cities. The protest movement reached its apogee a week ago Saturday with the burning of a movie house in the oil town of Abadan. Nearly 400 people died.

The protests, of course, have a point. The shah has driven his country forward at a fearful pace. Economic growth has averaged around 10 percent annually for the past decade. The population has moved at a dizzying pace out of scattered villages and into Tehran and other cities. Literacy, at only 10 percent 1950, is now at 60 percent.

Women have been admitted to schools and given access to jobs. Big landholdings, including those used for religious and redistributed - in some cases to small holders, in others to agribusiness. Huge bazaars, whose storekeepers paid rent to the mullahs, or religious leaders, have been bulldozed to make way for shopping centers with supermarkets that pay rent to the government.

The breakneck pace of development has created terrible dislocation. Tehran, like each other major Iranian city, suffers from acute housing shortages, traffic congestion and frequent power outages. Drug addiction, alcoholism and other signs of maladjustment are common among young people unable to find their feet in the swirl of city life. Inflation and corruption are endemic. And on top of all those ills, the shah has tried to force his way by means of the armed forces and a large secret police.

Inevitably, resentment to the regime has mushroomed - particularly among the large numbers of Iranian students being educated in Iran and the United States. Some of the opposition in Iran and abroad has a left-wing, even communist, flavor. But the beating heart of the anti-shah forces in Iran, the leaders who can mobolize masses, are the Islamic fundamentalists - the mullahs who oppose modernization itself and yearn for a more orthodox, Koranic life free of industry, urbanization and liberated women.

The best the shah can do, under those conditions, is temporize. He can slow the pace of growth, as he did in the present budget. He can make symbolic changes among his ministers - as he did over the weekend in removing Jamshid Amouzegar, the brilliant American-trained technocrat, as prime minister, and replacing him with the more traditional figure of Jaafar Sharif-Emami.

But the opposition in Iran cannot take over. It is incapable of managing a modernization process that has now gone too far to be reversed. The overthrow of the monarchy in Iran would probably yield, first, chaos and then a depotism far more fearful than the relatively soft authoritarian rule presently being asserted.

The point acquires special force given Iran's position in the world. Pakistan remains in flux, following the arrest and trial of former prime minister Zulfikar Ali Bhutto. Prime Minister Morarji Desai, now in his 80s, cannot long rule India, and no successor is visible. Afghanistan, since the left-wing coup last spring, is rapidly being taken in tow by Moscow.

So the shah's regime is the only barrier in an ocean of instability. It provides what little resistance can now be mustered against Russia's traditional push toward the Persian Gulf. That is why Hua, after trying to encourage resistance to Russia in Romania and Yugoslavia, stopped off in Iran on his way back to China. With far more authority than Western leaders mixed up in Iran's oil and armaments trade can command, the Chinese leader is announcing to the world that the shah comes close to being indispensable.