The Moscow Olympics, a curious amalgam of athletic and political games that will occupy a prominent place in sports history, ended tonight with spectacular ceremonies and fireworks at Lenin Central Stadium.

The first Olympics ever held in a Communist country ended with the same colorful flair for pageantry and mass showmanship that distinguished the opening ceremonies on July 19, though on a more limited scale.

The 90-minute closing exercises -- during which the Olympic flame that had burned atop the massive stadium was extinguished after two eventful weeks -- came to an end with a bang. In fact, with many bangs, as brilliant fireworks exploded against the charcoal sky.

Moments earlier with 3,000 dancers and gymnasts shaking bright streamers and waving farewell as the giant television screens on the stadium scoreboards flashed a montage of the competitive highlights of the Games, a helium-filled, 40-foot likeness of Misha, the cheerfulbear mascot of these sometimes unsmiling Games, was released.

As Misha followed a cluster of large, multicolored balloons into the stratosphere and fireworks filled the sky, the scoreboards flashed the lyrics of a songcomposed for the occasion: "Goodbye, Moscow, goodbye . . . farewell to the Olympic fairy tale . . . may your wishes come true . . . let good friends meet again."

Then, as the celebrants in their festival native costumes marched off the field, the scoreboard message changed: "Till the meeting at the Games of the XXIII Olympiad." That will be in Los Angeles in 1984.

As in the opening ceremonies,most of the 81 countries that had athletes participating in the Games were represented by their national flags in the closing parade, and 18 by the banners ofthe International Olympic Committee (IOC) or their national Olympic committees -- their manner protesting the Soviet invasion of Afghanistan without actually joining the boycott spearheaded by the United States.

The U.S. absence here was emphasized when the Los Angeles city flag -- yellow, red, green and white, bearing the municipal crest -- was hoisted, and Olympic hymn played, in the part of the ceremony signifying where the next summer games will be held.

According to usual IOC protocol, the U.S. flag would have been raised, and "The Star-Spangled Banner" played. However, the White House objected to any use of the Stars and Strips and national anthem in any connection with the Moscow Games, and the IOC belatedly acceded to the wishes of the U.S. government -- officially, to avoid embarrassment to the Soviet hosts, who feared diplomatic repercussions.

The rest of the formal closing ceremony adhered to the customary protocol. The flags and anthems of the Soviet Union and Greece (where the Olympic Games originated were used.

However, before declaring the Games closed in the manner prescribed in the Olympic charter outgoing IOC President Lord Killanin of Ireland made a brief speech, as he did at the conclusion of the winter Olympics in Lake Placid, N.Y. in February.

"I would like to ask all the sportsmen of the world to unite in peace before a holocaust descends," Killanin said, beginning an appeal to politicians to resolve the world's tensions, and to look on sport as a tool of peace rather than divisiveness.

Citing the generally high standard of competition at the Moscow Games, where 35 world records were set in five sports, Killanin said: "I only grieve for those who have not been able to participate."

Killanin, who will turn over the presidency of the IOC to Juan Antonio Samaranch of Spain on Monday, was warmly applauded by the athletes who ringed the rostrum and the 103,000 spectators who filled the stadium.

The Olympic flag was lowered and carried off by an eight-man honor guard dressed in powder blue suits, white shirts, red ties, white socks and tan shoe Unsettlingly to foreigners, they marched in the goosestep: the chosen ceremonial parade step of the Soviet Union.

The ceremonies -- distinguished by the bursts of color, theatrical touches, and precision dancing, acrobatics and parade maneuvers for which the Soviets are duly celebrated -- was a bittersweetoccasion.

The replays of some of the most thrilling moments of the Games reminded that the competition was often unexpectedly dramatic and enthralling, transcending at least momentarily the grim political realities of the event.

At the same time, the front row of seats all the way around the stadium was again occupied by Soviet soldiers -- some in uniform, others in blue track suits so as to look less conspicuous -- as was the case throughout the Games. This was an inescapable reminder of the massive and sometimes oppressive security, and the political undercurrent that runs strongly beneath all modern Olympics.

The past two weeks have been marked by political intrigues at many levels -- including suspicions of biased judging by Soviet officials in track and field events -- as well as by lofty athletic performances.

No one can assess accurately the impact of the boycott by the United States, West Germany, Canada, Japan, China and about 45 other nations. Killanin told The Washington Post: "The boycott probably hurt the Soviets' pride a little bit, but I don't think it's hurt them politically in any way whatsoever."

Almost 6,000 athletes from 81 countries participated in the Games, which encompassed 203 events in 21 sports. Originally more than 10,000 athletes from about 130 countries were expected in Moscow.

The boycott could be considered a domestic political success for the Carter administration as soon as the U.S. Olympic Committee voted in April, after much friendly persuasion and some hard-knuckled pressure, not to send a team to the Games for the first time since the modern Olympics began in 1896. t

This was a signal, at home and abroad, of the administration's deep concern about the Soviets' military aggression in Afghanistan, and of the majority opinion of the U.S. public that Moscow was an unsuitable site for Games dedicated to peace and friendship while Soviet troops were in Afghanistan.

However, the failure of many American allies, including most of the nations of Western Europe, to join the boycott was a political blow to the Carter administration, and was heraided as such by the Communist powers.

As Killanin said in his interview with the Post: "If you're going to use a boycott as a tactic, it's got to be effectively organized. This one wasn't -- I think because the White House didn't do its homework on how international sport is organized."

The U.S. initially set out to havethe Moscow Games moved, postponed or canceled. But this effort failed miserably.

The Games went on. Though not nearly as grandiose or global in impact as the Soviets had envisioned, they were indeed Olympics -- rich in pageantry and performance as well as controversy.

The Soviets and their Communist bloc comrades, notably the East Germans and Cubans, dominated the sports competition, as reflected in the medal count. a

Athletes of the host country won 197 medals, including 80 gold. That eclipsed the Soviets' previous records of 50 golds (Munich in 1972) and 125 total medals (Montreal in 1976), and may have set a standard that will not be surpassed unless one of the superpowers again boycotts an Olympics.

The Soviets were careful not to flaunt their monopolization of medals to the rest of the world, however. They are much too diplomatically savvy for that.

Instead, Vladmir Popov, the vice president and spokesman of the Moscow Olympic Organizing Committee, never mised an opportunity to congratulate the other 36 countries that won medals, and to stress "the great geographic and regional distribution of medals at these games."

Popov's daily press briefing was a show in itself: a tour de force of clever rhetoric and verbal tapdancing highly unusual for the Soviet Union, where direct questioning of officialdom by the press hardly ever is seen.

Popov's official pronouncements were, of course, the only vows reported in the tightly controlled Soviet media. The ordinary citizen had little, if any idea, for instance, that there was widespread dissatisfaction in the West with the Soviet judging of track and field events, or that there were limited protests of the Soviet invasion of Afghanistan at medals presentations.

Soviet television almost never showed the hoisting of IOC flags and the playing of the Olympic hymn in lieu of national flags and anthems, the way 15 Western nations chose to express their outrage at the Afghan invasion.

Soviet citizens in attendance saw these muted protests, and some undoubtedly understood the reasons for them, but the average citizen who followed the Games in the mass media had no idea anything was amiss. Soviet TV cameras, which provided most of the world's picture, cleverly panned to national flags being waved in the stands by spectators and made it seem that everything was according to traditional protocol.

As a sports event, the Moscow Games had more than their share of scintillating moments. The 35 world records set were only one shy of the number established at Montreal, a gauge of the high level of performance which Popov stressed daily.

For every sport that was sub-standard, (basketball, hockey, and some other team sports, for example) and for every potential gold medalist who was conspicuous by his or her absence, there was a corresponding case of an athlete in Moscow rising to the occasion with an Olympian performance that will live on in memory.

Alexander Dityatin's collection of eight medals in men's gymnastics, Yelena Davydova's unlikely victory in the women's all-around, Vladimir Slanikov's breaking of the 15-minute barrier for the 1,500-meter freestyle swim, Lutz Dombrowski's log jump of more than 28 feet, Wladyslaw Kozarkiewicz's world record high jump, ageless Miruts Yifter's double in the 5,000 and 10,000-meter runs, and Waldemar Cierpinski's repeat triumph in the marathon all were golden moments.

There were others, too, worthy of the Olympic motto of "citius, altius, fortius" -- "swifter, higher, stronger."

The Games were smoothly run -- a little too slickly, in the case of track and field judging, where the International Amateur Athletic Federation had to put its red-coated supervisors back on the field after allegations that Soviet judges were measuring throws and calling fouls to the benefit of Soviet competitors.

There were none of the technical problems in conducting and timing events that had been predicted after the U.S. and some other countries cut off exports of Olympics-related equipment. The complex computerized information system worked flawlessly. Communications and transportation were adequate. The security and bureaucracy were maddening, but the helpfulness of lower-level staff, especially Soviet youth, was sincere and heartening.

If one of the Soviet objectives in hosting the Games was to prove that they could meet all the technological imperatives of a modern Games, including the invasion of a small army of athletes, media, technicians and spectators, they succeeded.

But the portrayal of opulence, including lavish spreads of food achieved at the expense of citizens in parts of the Soviet Union and its satellite neighbors who went wanting, was in many ways what students of Russian history will recognize as a "Potemkin village."

The term derives from Prince Grigory Aleksandrovich Potemkin (1739-91), a statesman and favorite of Empress Catherine II who erected a facade of fake villages in order to impress the empress on her visit to New Russia in 1787. He was gambling that the empress would not alight from her coach and realize that the population and prosperity of the region were not as they appeared.

The kind of existence that most foreign tourists saw in Moscow during the two weeks of the Olympiad, when they had extremely limited contact with average citizens, bears little resemblance to everyday reality here.

In that sense, the Olympics were a gigantic propoganda exercise -- one of the grandest "Potemkin villages" in history. It will be interesting to see how the Games of the 22nd Olmpiad are ultimately remembered by those who were here . . . and fascinating for the foreigners who live here to observe what imprint, if any, the Olympics leave on Soviet life, when, as one Western correspondent put it, Moscow settles down and returns to abnormal.