Italy's National Olympic Committee in defiance of a government ruling, voted overwhelmingly today to attend this summer's Moscow Olympic Games, leaving West Germany as virtually the only major Western European country to support the U.S. sponsored boycott.

Five other European Olympic committees from Austria, Belgium, Ireland, the Netherlands and Sweden announced yesterday they would send teams to the games, joining France which last week was the first Common Market country to decide against the boycott. Portugal's Olympic Committee earlier announced it would participate in the Games.

President Carter initiated the movement to boycott the Moscow Olympics to protest the Soviet invasion of Afghanistan last December. So far 30 Olympic committees, including Canada, Kenya, Egypt, Argentina, Chile and China, have joined the United States in the boycott. But only four Western European countries, West Germany, Norway, Monaco and Liechtenstein, are on the boycott list.

The Italian committee voted 29 to 3 with two abstentions to attend the Games despite a ruling by the Italian government yesterday that Italian teams going to Moscow would be denied official status. The government urged the Olympic committee to consider the ruling "with attention" and to adopt decisions "that are in conformity with the national interest."

In explaining its decision to attend, the Olympic committee said "participation in [the Games] cannot in any way be considered as acceptance of any ideology or political behavior. The athletes have a right to full recognition of the sacrifices they have long made to prepare for the Olympics. . . ."

The three negative votes came from the equestrian, yachting and modern pentathlon federations.

Meanwhile, in a last-ditch effort to promote a boycott by the British teams, British Prime Minister Margaret Thatcher today wrote a new letter to British Olympic Committee Chairman Denis Follows, holding up the West German example and urging the committee to reverse its earlier decision to attend the games.

Follows, who has steadfastly refused to consider change, said he would inform committee members, but political observers in London said that Thatcher's new pressures were not likely to have an effect.

In addition to Italy, the Dutch and Irish Olympic committees' decisions to attend the Games were made against the recommendations of their governements.

The decisions to ignore the boycott dashed forecasts last week that West Germany's joining the boycott movement would sway other European countries.

The Italian government yesterday noted that the Italian committee was legally independent and free to make its own decision. Christian Democrat Prime Minister Francesco Cossiga was clearly expecting the antiboycott decision.

The issue has sharply divided Italy's major parties, with the left wing of the Socialist Party, a partner in the current governing coalition, and the powerful Communist Party opposing the boycott.

Communist Party Leader Enrico Berlinguer said yesterday that the government ruling was "a genuine act of provocation and a new confirmation of the subjection of the government toward the current president of the United States."

Cossiga used careful terms to couch his government's decision to back the boycott. Rather than directly mentioning the Soviet invasion of Afghanistan he said that the boycott by many countries had ruined the Games' "universal character" and argued that the Games could not be isolated, from world events and Italian participation could be given a political interpretation.

The Italian government's ruling stated that Italian athletes attending the games will do so in a private capacity and will be prohibited from using either the Italian flag or the national anthem.

The 27 probable Olympic contenders who are members of the Italian armed forces may also be forbidden to attend. Socialist Defense Minster Lelio Lagorio said yesterday that those atheltes "owed their primary allegiance to the minister of defense."