Nine years ago last month, workers and housewives in Poland led the most violent rebellion against an East European communist regime since the Hungarian uprising of 1956. They set fire to Communist Party buildings, seized control of shipyards in Gdansk and Szczecin and forced party leader Wladyslaw Gomulka out of office.

The issue was food or, more precisely, a series of extraordinally ill-timed, pre-Christmas food price increases ordained by the government in Warsaw.

It is worth recalling this history now, in light of suggestions that the United States "shot itself in the foot" when President Carter responded to the invasion of Afghanistan by withholding 17 million tons of Soviet-bound grain.

The loss of a major overseas market will require some difficult adjustments by U.S. agriculture. The effects will not, however, be disastrous and may even help ease some of the pressures on the nation's food system in the 1980s.

As for the Russian people, they will pay a tangible price for their rulers' decision to send the Red Army into nonaligned Afghanistan. Nobody will starve because of the president's action. But Soviet consumers will have to forgo the improvements in their diet that their government has been promising ever since the Polish rioters shook the entire Soviet bloc in 1970.It is hard to imagine how the president could have sent the Russian people a more direct message.

After Poland's troubles, "consumerism" was officially in bloom in Russia and in its satellite countries, with a special emphasis on better food and more housing. The need to improve Soviet living standards was always an underlying imperative behind the "detente" of the 1970s. This is still unfinished business for the Kremlin.

Food still uses up nearly half the disposable income of Soviet families, compared with under 20 percent in the United States. That is why the Kremlin leaders took the unusual step in the first place of spending at least $7 billion of scarce foreign exchange to purchase 75 million tons of grain and soybeans from their main global adversary, the United States.

Grain imports enabled agricultural managers to build up supplies of poultry, hogs and cattle. By 1975, Russians were eating an average of nearly 130 pounds of meat a year, compared with 105 pounds in 1970. That was still much less than the U.S. average of well over 200 pounds, and was below that of most East European countries, too. But it was progress, and Russian consumers appreciated it.

Then came a harvest in 1975 that was so terrible not even imports could sustain the livestock on hand. Numbers decreased and meat consumption fell off. With the help of massive grain imports, meat eating was just getting back to the 1975 level when Carter announced the cutoff.

The Department of Agriculture believes the Russians need 125 million tons of livestock feed this year. So Carter's decision to deny the Russians 17 of the 25 million tons they had counted on from here totally disrupts their plans.

Nobody is quite sure about the severity of the impact because of the uncertainties of the international grain trade. This is a vast, secretive business dominated by a handful of companies that answer to no single government.

With more than 200 million tons of grain a year moving out of and into dozens of ports all over the world, the possibilities for rerouting, transshipment, swaps and commercial skulduggery are plentiful. The Department of Agriculture acknowledges that three million tons of U.S. grain will leak through to the Soviets. Exporters Canada and Australia have promised not to sell extra grain to Russia. Still, Argentina, Brazil, Turkey, France and a few others may increase shipments to the hard-pressed Russian grain men. To help tide them over, the Russians also will be able to buy some meat on world markets.

But there are limits to how much they will be able to make up from others, given the structure of a grain market in which traditional big food industries in Japan and Europe, demand their usual share. The Russians turned to the United States in the first place because only America consistently had the exportable volumes they needed. The No. 2 exporters is Canada. Yet its total grain shipments to all countries last year were about equal to the amount that Carter has just withheld from the Russians.

If the Carter administration can hold most of the other big exporting countries in line, use its muscle to punish grain companies that undercut the policy, and resist election-year pressures in the farm belt to dump the withheld grain onto world markets, the Russians will hurt. Even if the Soviet government can scrape up an extra four million tons of non-American grain, they will still be around 10 million tons short of livestock feeds.

They can conserve some grain by altering feed rations or holding back their usual grain shipments to Eastern European countries, a step that would heighten instability on their border. But even with these measures, the expected dietary takeoff will be thwarted. In the short run, there will be more meat in the markets as livestock is culled. Kremlin propagandists will make the most of this. But a year from now, it should be clear to ordinary Russians that their government's imperialistic adventure in Afghanistan has set back their hopes for cheaper, more plentiful food.

By then, U.S. agriculture will have adjusted fairly well. The real question is whether the system could have sustained the growth in exports foreseen for the rest of the decade without stricter limits on Russian purchases.

Food is, indeed, a clumsy and ineffective diplomatic "weapons" in most international situations. This is one of those rare occasions when it is neither. President Carter has preceived correctly that food is a vital component of Soviet security in the broadest sense. Because of that country's enormous dependence on America for this food, the U.S. government has a diplomatic step at its disposal that is far preferable to the extreme alternatives: doing nothing or stepping up the arms race.