The Soviet Union, the world's largest oil producer, is reporting its first decline in oil output of the postwar period. The shortfall in planned production, in the view of western analysts, may have been behind recent personnel shakeups, the first in Moscow since the new Soviet leader, Mikhail Gorbachev, took office March 11.

Last year was the first in which Soviet oil production fell since World War II. In the first two months of this year, the decline accelerated. Production for January and February fell 2.4 percent below last year's levels, from 12.22 to 11.915 million barrels a day, according to Soviet data available in the West.

Ed A. Hewett, a Soviet economic expert at the Brookings Institution, and other analysts predict that the downward trend in Soviet oil output will drag on through the end of the 1980s.

That would undercut Moscow's ability to earn critically needed western hard currency, and possibly strain relations with its Warsaw Pact allies, who rely considerably on the Soviets for energy.

The drop comes sharply on the heels of a Moscow push to boost its hard currency earnings by stepping up exports of oil and oil products to the West.

It also emerges in the midst of two other developments that, western analysts say, may cast a shadow over the Soviet Union's heavy dependence on oil exports to the West: the worldwide stagnation of oil prices and the continued decline of oil production throughout most of the Eastern Bloc.

Western oil exports account for more than 60 percent of the Soviet Union's foreign revenue.

Flagging domestic agricultural harvests, western analysts say, have pressured the Soviets into seeking more foreign currency earnings for grain purchases.

Moscow apparently blames its oil production problems on poor management.

In February, Oil Minister Nikolai Maltsev retired prematurely at age 56. Vasily Dinkov, 60, formerly gas industry minister, replaced him.

Shortly after, Pyotor S. Neporozhny, 74, was retired as minister of electrical power.

His ministry was often cited in the Soviet press for failing to provide to distant, underdeveloped provinces even the rudimentary infrastructure, such as power lines, necessary for oil exploration.

The replacement of Neporozhny was the first of a high-level official since Gorbachev came to power. Several other regional personnel changes, particularly in Tyumen province, where oil production is concentrated, were also reported.

Kremlinologists first detected the difficulties in the mid-1970s, when production began to fall short of official Soviet targets.

Last year, the production target was 12.48 million barrels a day but actual production was only 12.22 million.

Until the end of the last decade, production levels had climbed impressively.

Between 1970 and 1980, Soviet crude oil production rose from 7.06 to 12.06 million barrels a day.

In 1980, output shot up by 353,000 barrels a day. Thereafter, the increments of increase slid -- from 112,000 barrels a day in l981 to 68,000 in l983.

In early 1984, following a trip by a high-level Soviet delegation to oil fields, production levels rebounded, albeit briefly.

In June they began to fall again. Last year's production rate was 12.22 million barrels a day, compared to 12.33 million in 1983.

Since 1977, western intelligence analysts have warned that unsophisticated Soviet technology and drilling methods, the steady dwindling of resources in the major Volga-Urals and Siberian oilfields, and labor force shortages in the rugged oil producing regions were putting the Soviet Union on the brink of a major oil production crisis.

"The timing was off," Hewett said of the oft-cited reports, "but it turns out the reasons were right."

He and other Soviet analysts think that the best explanation for the decline is that the giant Siberian oil fields have begun to run dry before the Soviets expected they would.

For years, Soviet producers have relied on a few major fields, mostly in Siberia, to provide the bulk of their oil.

Also, one U.S. diplomat said, "The most lucrative oilfields happen to lie in areas of the country most difficult to develop due to harsh climate. The fact that the Soviets have done much too little exploratory drilling means that they're now in the dark as to where to look for untapped resources."

The Soviets have followed up their high-level managerial shakeup by seeking to redouble rig personnel in strategic areas.

They have predicted that oil production will recover this year, to 12.6 million barrels a day, 3 percent above last year's level.

Western analysts consider such expectations exaggerated.

Last winter, Moscow canceled oil shipments to some of its Western European customers.

But analysts were uncertain whether the cutoffs, which have occurred occasionally in past years, were because of harsh weather, oil shortfalls, or both.

Whether the Soviet oil situation becomes more serious depends on how quickly Moscow moves to counter production deficiencies, and how adeptly it develops oil substitutes, in the view of analysts.

In recent years, the production of natural gas has increased more rapidly than the production of oil has fallen. Western observers have been surprised at how quickly the Soviet Union has tapped natural gas fields and laid pipeline in conjunction with its major, much-publicized natural gas contracts with the West.

Moscow is now exploring ways to substitute gas for oil in domestic use, and for increased export to Eastern Bloc countries, thus allowing the Soviets to keep up high levels of oil export to the West.