Fifty-six countries are supporting President Carter's call for a boycott of the Moscow Olympics this summer to protest the Soviet invasion of Afghanistan, the State Department announced yesterday.

But at least 68, including most of the major Western European countries, will participte in the Games, and, with midnight tonight as the deadline for accepting Olympic invitations, 21 others are undecided, including, most notably, Japan.

"It's sort of obvious we would have liked to have gotten more of the Western European countries," said deputy White House counsel Joseph Onek.

"But we feel we have done very well everywhere else. In Western Europe where they have the greatest tradition of independent Olympic committees, we didn't do so well."

The boycott efforts were dealt a setback yesterday when Olympic committees in Spain and Australia, disregarding stands taken by their respective governments, voted to send athletes to Moscow this summer.

In Australia, the Olympic Federation's 6-to-5 vote to participate followed a vigorous campaign by Prime Minister Malcolm Fraser in support of the boycott.

"I pray that the Soviet Union will not interpret this and other decisions of Olympic federations as a weakening Western will," said Fraser in a press statement.

Spain's Olympic committee voted 18 to 11, with one absention, to go to Moscow, only hours after the government of Premir Adolfo Suarez declared that Spain should protest the Soviet invasion of Afghanistan by backing the boycott.

That action followed a pattern set in several other West European nations where the governments endorsed the boycott but Olympic committees voted to send teams to the Games.

Great Britain, for example, will send athletes to Moscow despite Prime Minister Margaret Thatcher's staunch support of the boycott. Boycotting the Olympics, Thatcher told the London Daily Mail, "is the only way you could bring home to the Russian people the shock and anger of the West and the horror of what their government has done."

Despite her strong views, Thatcher said she would take no steps to prevent British athletes from competing at Moscow.

Of the West European nations, only West Germany, Norway, Leichtenstein and Monaco are supporting the boycott. Within the last week, Olympic committees in Italy, Belgium, the Netherlands, Ireland and Sweden voted to join England and France in participating in the Olympics.

Nations joining the American-led boycott include China, Canada, Egypt, Israel, Argentina, Bolivia, Indonesia, Kenya, Phillippiners, Saudi Arabia, South Korea, Thailand and Uruguay.

The major power among the undecided nations is Japan, whose Olympic committee is scheduled to meet today on the issue. Last month, the Japanese government announced unequivocal opposition to participation, but since then the government of Prime Minister Massayoshi Ohira has been given a vote of no confidence and new elections have been called.

One proposal before the Japanese committee is to send only athletes with good chances of winning medals.

Although the United States is not participating in the Games, Olympic trials are being held, and teams are being chosen in 21 sports.

"The athletes will be given proper recognition," said Miller. "There will be a reception at the White House. They will be given a medal authorized by Congress. There will be a gala affair at the Kennedy Center and they will be provided with complete uniforms that they would have received if they were going to the Olympics."

Miller was in Washington yesterday working on arrangements for the event, which he said might also include a parade by the 525 athletes from Capitol Hill to the White House.

In April, under heavy pressure from the administration, the USOC voted to support the Olympic boycott. In return, the president has agreed to lead a drive to help the committee recover money it expects to lose by not going to the Games.

Yesterday Carter invited 20 corporate chief executives to a White House luncheon to ask for contributions to help offset the $6.5 million to $7.5 million to individual and corporate contributions that the committee expects to lose.

The president also has asked Congress to provide $10 million for the USOC on a one-for-two matching-fund basis, whihc could net the organization $30 million. The money would be used for financing international sports competitions and for training U.S. athletes to compete in the 1984 Games to be held in Los Angeles.