A ranking official of the International Longshoremen's Association said privately yesterday his union is "seriously considering" a boycott against the loading and unloading of all cargo to and from the Soviet Union.

The ILA official said the union is studying the action "to let the Russians know that we are serious" in opposing the recent Soviet invasion of Afghanistan.

A total boycott of Soviet Cargo, should it be approved by the ILA's executive board, could be announced this afternoon, said the ILA official, who did not wish to be identified. The union earlier had indicated it was considering a boycott just of grain cargoes bound for the Soviet Union.

Subordinate officials of the ILA confirmed yesterday that a proposed total boycott of Soviet cargo was under consideration. But they declined to give any details.

Since Nov. 9, the 116,000-member ILA has had in place an identical boycott of the handling of Iranian goods, in protest of that country's holding of 50 Americans hostages. Yesterday, the Brotherhood of Railway and Airline Clerks (BRAC) announced it was joining the action against Iran.

"We're asking the union's membership to refuse immediately to handle any grain or other shipments destined for Iran from North America locations," said BRAC President Fred J. Knoll.

Knoll said his union "fully supports the efforts to limit or stop transportation [of goods] to and from Iran until the hostages are freed and returned to this country."

In a related development, the five U.S. and Canadian board members of the International Transport Workers Federation, an umbrella group for unionized transport workers, has called for a "world-wide industrial action" against Iran.

Henry Fleisher, a Washington spokesman for American members, said the federation has agreed to hold an executive meeting within two weeks to take up the issue.

"I suspect that they will be talking about getting others [European unions] involved in the Iranian boycott. . . . The Russian situation may also enter this by the time the meeting comes off," Fleisher said.

He said he was not surprised to learn that the ILA was considering extending its Iranian boycott to all Soviet cargo.

"The ILA usually boycotts shipments to Russia if somebody sneezes wrong in the Kremlin. With something as serious as the Afghanistan invasion, I wouldn't be surprised at all if they stopped loading everything going to Russia," Fleisher said.

A federal trade official, who requested anonymity, commented: "They've done things like that before. It's in character. The delicacies of diplomacy are not normally their strong points."

The trade official said he could not say exactly what beyond grain and high-technology equipment -- already singled out in President Carter's economic sanctions against the Soviets -- the United States exports to Russia.