The Soviet Union is heading toward a huge grain harvest that Soviet sources believe will exceed 220 million tons and may set a record.

The size of the Soviet harvest is an important factor in world grain trade. Wild fluctuations in grain production have led Moscow to import massive amounts of wheat and corn during lean years. That has wrought havoc in in Western grain markets, especially the United States, which had become Moscow's chief supplier of food.

The optimistic Soviet forecast is echoed by American agricultural experts here. The current U.S. Department of Agriculture estimate for the 1978 Soviet harvest is 215 million tons, but, an American official said, "We anticipate that that figure will be going up."

Last year the Soviet crop totaled a disappointing 195 million tons, forcing the Soviets to import more than 20 million tons from the United States, Canada and Australia. The largest quantities came from the United States and included 3.5 million tons of wheat and 11.3 millions tons of corn.

Should the 1978 forecasts prove correct, Moscow's grain import needs would be reduced substantially and demand in world grain markets would decline.

But the Soviets will have to purchase at least 6 million tons of U.S. grains in the year beginning in October under the terms of a U.S. Soviet agreement designed to reduce wild fluctuations in Soviet purchases in the United States.

The five-year agreement, which went into effect in October 1976, commits the Soviet Union to buying at least 6 million tons of U.S. grains annually regardless of how good or bad its own harvest is.

A disastrous harvest here in 1972 led to massive Soviet grain purchases in the United States, driving prices up and ultimately striking at the pockets of American consumers.

Moreover, the Soviet purchases helped accelerate American inflation and increase world food costs.

The huge crop shortfall was followed by a bumper crop of 223 miilion tons the next year. After two subsequent lean years the Soviets had a record harvest of 224 million tons in 1976.

In 1975, largely because of severe drought, the Soviets harvested only 140 million tons of grain compared to a target of 215 million tons. They bought about 15 million tons of U.S. grains that year.

Along with the optimistic grain forecast, however, there are persistent reports of severe meat shortages throughout the Soviet Union except in principal cities. These reports are confirmed by Western travelers returning from the Soviet interior.

Diplomats here attribute these shortages to wholesale slaughter of animals during the lean years and inefficient efforts to replenish the herds, as well as to excessive agricultural bureaucracy.