Modern structures of glass, concrete and aluminum commingle with aging stone mansions and mosques. Oil derricks puncture the skyline on the outskirts of town. The wide blue expanse of the Caspian Sea and lush palm trees round out the scene.

Welcome to Baku, capital of Soviet Azerbaijan, a unique city of the U.S.S.R. Besides its visual beauty, what makes this city different from its urban Soviet brethren is its curious mixture of oil and Islam. Less than 200 miles to the south, the same mixture bubbles close to explosion in neighboring Iran.

Baku, by contrast, has lost the Middle Eastern turbulence of its earlier years and settled into a kind of prosperous and even genteel Soviet middle age.

Around the turn of the century, Baku produced half the world's oil, attracting technology and money that transformed a Moslem shantytown into a modern city. Its elaborate stone mansions bear witness to the times when the French Rothschilds and Sweden's Nobel brothers held concessions for pumping oil on the sandy Apsheron peninsula.

Strictly speaking, Baku was the first and only true center of capitalism in czarist Russia. The largest prerevolutionary strikes occurred here in 1913 with 50,000 oil workers taking part. Writer Maxim Gorky described the "black town" where they lived as a slice of hell.

Stalin's career as a professional revolutionary took shape here. He was active in Baku for more than a decade and was said to have deftly planned bank robberies that financed the movement that eventually seized power in 1917.

Azerbaijan's crude oil production is now merely a drop in the ocean of Soviet production. It produces about 125 million barrels a year out of a Soviet total of nearly 4.5 billion. Many derricks stand idle like prehistoric monsters against the barren landscape as the search for oil has moved deeper into the Caspian.

After 100 years and more than 7 billion barrels of oil, the Baku oilmen have set up a spidery web of iron causeways and piers that extend 10 miles into the windswept Caspian, where drilling rigs have to reach nearly four miles deep to get at new sources of oil.

Nature's whims and man's folly have combined to make the life around the Caspian more difficult and precarious. Daily winds that have reached 140 miles an hour preclude the possibility of operating floating platforms.

Nature also has shrunk the sea. The Caspian is now about 30 feet lower than 50 years ago. Man's contribution to this natural process has been considerable.

Under the Soviet electrification plan, scores of hydroelectric power stations have been built along the Caspian's main tributaries, creating artificial lakes and dramatically increasing their evaporation. As a result, according to Soviet experts, the volume of fresh water coming into the sea has sharply decreased.

In addition, the Soviets have constructed the Kara-Kum Canal on the Letter From Soviet Azerbaijan eastern shore of the Caspian to irrigate the vast barren areas of Uzbekistan and Turkmenistan. All of this combined to make the waters of the Caspian more salty.

The ecological threat prompted the Soviet government to construct a dam at the entrance to the Kara-Kum Canal two years ago. According to Alegaper Sulejmanov of the Azerbaijan environmental protection office, the drop in the sea level has been halted and reversed by about 30 inches.

Another victim of electrification has been caviar, the other "black gold" of the Caspian. The fall in the water level destroyed some spawning grounds for the sturgeon that produce caviar. Industrial wastes have polluted others.

As a result, the largest Caspian tributary, the Volga, which once produced vast quantities of caviar, now produces hardly any. In turn, caviar has become staggeringly expensive.

In an effort to preserve the country's precious caviar production, the Soviets have turned to artificial methods of raising sturgeon. More than 10 million sturgeon are raised in three hatcheries run by the Azerbaijani fishing and water resources administration. The government has also adopted a clean water act imposing heavy fines on polluters.

The production of caviar is far from simple. Sturgeon take from 7 to 15 years to reach egg-bearing maturity. They make annual pilgrimages to their birthplace and then return to sea. Officials here estimate that only 6 percent survive to maturity to spawn in shallow waters to leave the roe that becomes black caviar.

Leaving nothing to chance, the Soviets catch the sturgeon as they head up one of the four main tributaries and inject the fish with hormones to induce speedy birth.

But just when the Soviets thought that they had resolved the problem created by pollution and evaporation, a new problem arose following the Iranian revolution. It is reliably reported that the Iranians on the southern shores of the Caspian are decimating the sturgeon supply in an effort to produce caviar to sell cheaply to Western buyers.

Nobody here is prepared to discuss this problem because of its political implications, just as nobody seems prepared to discuss the Iranian religious revival itself.

The issue is a touchy one since more Azerbaijanis live in Iran than in Soviet Azerbaijan. They share a common language, a common culture and the Moslem religion.

The shock waves of the Islamic revival, at least on the surface, do not appear to have penetrated the 740-mile border into this republic, despite close ethnic and family ties.

"Iran is not an Islamic republic," said a cab driver who described himself as a devout Moslem. "The Americans, Russians and French are in control there."

The man authorized to speak to foreigners about such issues is Sheik Alloshukur Pashazadev, the mufti of the Transcaucasus and head of the Moslem spiritual board for Azerbaijan, Georgia and Armenia. While the 31-year-old sheik is a Shiite, his deputy, Smail Ahmedov, is a Sunni.

"What happened in Iran could never affect us because we have a better life than they," the white-turbaned sheik said. He said there were six functioning mosques in Baku, a sufficient number he believes for a city of 1.5 million. In Islam, he explained, "there has to be a direct and private communication between the believers and the supreme being" and this could be accomplished at home.

Azerbaijani intellectuals said they saw no reason to worry about Iran's Islamic revolution because the living standard on the Soviet side of the border is demonstrably higher.

Moreover, they insist, illiteracy has been all but wiped out in Soviet Azerbaijan along with famine, epidemics of disease and legal discrimination against women. Because of its oil, Azerbaijan has developed much faster than other Moslem republics in the Soviet Union.

With its ethnic and linguistic homogeneity--only 10 percent of Azerbaijan's population is comprised of ethnic Russians compared to 26 percent in Uzbekistan or 48 percent in Turkmenistan--the republic appears to enjoy considerable autonomy.

The sheik noted that his communities' relations with state authorities have improved and that Sunnis and Shiites pray together. He and his colleagues, the sheik said, are preaching "the spirit of patriotism, love for the country and the principles of Islam."

"Iran's revolution is an interesting event, but there is the question of arms control," he said.

That Islam is an underlying problem in this Soviet republic can be seen from antireligious propaganda published daily in the press and taught in schools.

A play by Azerbaijani author Djarar Djabarli performed in the gleaming new Palace of Culture demonstrates the government's message. It depicts the republic as the national center of the Azerbaijani people, who were detached from the Turkish world two centuries ago.

The play, "Aidin," shows the area during the oil boom in prerevolutionary Russia, with millionaires spending money on prostitutes and drink and young progressive Moslems opposing them. It ends with the heroine throwing off the chador to gain freedom from the two evils--capitalism and religious obscurantism.