Leaders of the nation's largest dock worker union yesterday announced a total boycott against the loading and unloading of cargo to and from the Soviet Union.

"The boycott is total. That means that nothing -- nothing -- goes in or out, no matter what it's moving on," said Thomas (Teddy) Gleason, the septuagenarian firebrand president of the International Longshoremen's Association (AFL-CIO).

The boycott, a response to the Soviet Union's recent invasion of Afghanistan, will last "as long as the Russians insist on being international bully boys," Gleason added.

The main U.S. export to Russia is grain, and most grain exports had already been embargoed by President Carter.

Carter had also announced he would restrict exports of high-technology equipment, and the Commerce Department had halted consideration of future export permits. Yesterday, Carter went further and also held up exports under some permits already granted.

Meanwhile, grain futures markets reopened yesterday, after a two-day government-ordered holiday, and prices instantly fell the limits permitted by market rules. The administration has said it will buy up all the grain that had been destined for Russia, and on Monday it also announced higher grain price supports. But farm groups said farmers would still be hurt by suspension of the Soviet sales.

The administration, which has objected to past ILA boycotts against the handling of Soviet cargo, was notabl muted yesterday in its response to the union's action.

"We understand the reason for their decision," said White House spokesman Jody Powell. "Mr. Gleason has indicated his desire to advance the goals of American foreign policy. . . . We are discussing with them their actions and our posture with a view toward arriving at a situation that would further advance the goals of American foreign policy," Powell said in a statement open to any number of different interpretations.

State Department spokesman Hodding Carter attempted to be more succinct.

"We can't say that someone has no right to express himself. But we hope that the steps would be those arrived at by the democratic -- with a small 'd' -- leadership of this country," the department spokesman said.

There was a more direct response from the AFL-CIO, the nation's leading federation of organized labor which has built a reputation for talking tough to the Russians.

"Hooray," said AFL-CIO spokesman Allen Zack, reflecting the sentiments of the federation's leadership.

"We think it's a responsible step and we're proud that a bunch of trade unionists are taking it," he said of the boycott."We think it's totally in line with American foreign policy."

According to Commerce Department figures, the United States exported $3.4 billion worth of goods to the Soviet Union last year. Agricultural products comprised the largest chunk of that, peaking at $2.6 billion.

Imports of Soviet goods, mostly metals, ammonia and some vodka, reached $700 million last year.

The ILA refused all through the 1950s and 1960s to handle cargoes to or from Russia. It relented in the early 1970s, as trade with the Soviets expanded. Now the union is reverting to its traditional stance.

The full commercial effects of its decision and the new White House actions were unclear last night.

"We have a contract with the U.S.S.R., and we intend to fulfill it," said Al Goetz, a spokesman for Pepsico, which has a 10-year contract to supply the Soviets with syrup concentrate to make Pepsi-Cola.

However, Goetz added that his company will abide by any administration decision to frustrate the thirst of Russia's Pepsi generation.

There are numerous other well known companies involved in trade with the Soviets. One is Occidental Petroleum Corp., which imports large amounts of ammonia from the Soviet Union.

Gleason said the boycott applies to all future Russian manifests. Work on Soviet freight and ships already at American ports at the time the boycott was announced will be completed, he said.

Russian passenger ships are also included in the ILA boycott, Gleason said.

The major items frozen by the president's order yesterday were high technology and strategic goods, which include computers, automobile technology, oil and gas drilling equipment, communications supplies and other possibly strategic information sold to Soviets.

Carter's order suspends all "validated" licenses for those products and freezes any further shipments of them. Validated licenses are those requiring Commerce Department approval before shipment.

The suspension of the exports, valued at about $200 million annually, is pending a review of the licenses, which is expected to take four to six weeks.

Carter's move affects hundreds of export licenses but other innocuous items can still be exported, a White House official said last night.

In Phoenix, meanwhile, members of the American Farm Bureau Federation said yesterday that Carter should cut all economic and cultural relations with the Soviet Union because its invasion of Afghanistan threatens U.S. security. "These would include business contracts, exchange programs, participation in the 1980 summer Olympic Games and all other contacts other than diplomatic ties necessary to resolve the current situation," said an emergency policy resolution adopted by the federation at its annual convention.