The turbulent gymnastics competition at the Moscow Olympics ended tonight with two individual apparatus gold medals for Romanian Nadia Comaneci and more curious judging disputes that smacked of a well-calculated plan to spread the remaining medals diplomatically among squabbling Socialist comrades.

Comaneci -- still wounded by the narrow and controversial loss to surprising Soviet Yelena Davydova in Thursday's all-around finals that created outrage back home in Romania -- won the gold in the balance beam. But instead of the admiring cheers she received four years ago in Montreal for her sublime performances, this victory elicited jeers from 10,000 spectators at the Lenin Sports Palace.

They thought, with justification, that the title should have gone to Natalia Shaposhnikova of the Soviet Union, who was more assured than Comaneci on the four-inch beam tonight. Shaposhnikova executed a difficult routine flawlessly, but got no satisfaction from the judges.

Comaneci also shared the gold medal in floor exercises, the glamorous closing event of the competition, with Soviet veteran Nelli Kim, 22, the popular Eurasian whose routine tonight did not appear up to championship standard. The gold seemed more like a farewell gift for the triple-gold-medalist of Montreal and defending world all-around champion -- a way of saying, "Thanks for the memories."

The sharing of the final gold medal was even more suspicious because Comaneci's score -- which seemed low when it was posted at 9.9 after a rousing routine -- was raised to 9.95 just before the presentation ceremonies, abruptly changing Kim's joyous tears to an angry frown.

Officials attributed the change to a computer malfunction, but it had all the earmarks of backroom wheeling and dealing -- the sort of cooperative agreement among politicians that Sen. Sam Ervin used to call, in down-home North Carolinese, "A bit of canoodlin' together."

There were a number of puzzling scores tonight, in the aftermath of Thursday's furor, and they all seemed to have a pattern -- an attempt to "even up" past injustices, to throw a sop here to the delegations (notably Romania's) that felt they had been jobbed, and a bouquet there to the fading princesses of a sport that mixes athleticism, artistry and intrigue in roughly equal measures.

The trend began this afternoon, when the gold medals on the six apparatuses of men's gymnastics went to six different gymnasts: Soviet all-around champion Alexander Dityatin in the rings, Bulgarian Stoyan Deltchev in the horizontal bar, Soviet Alexander Tkachyov in the parallel bars, Soviet Nikolai Andrianov (winner of four golds in Montreal) in the vault, East German Roland Bruckner in the floor exercises and Hungarian Zoltan Magyar in the side horse.

Dityatin's medal was his eighth, the most won by one person in an Olympics since the modern Games began in 1896. He took four golds, three silvers and a bronze.

Tonight, Shaposhnikova won the vault with efforts of 9.75 and 9.9, after Comaneci and 15-year-old Maxi Gnauck dropped from first and second to fifth and last by falling ignominiously to the mat upon landing.

Next Gnauck -- who led the all-around standings until the last rotation Thursday, then choked in the vault and shared the silver medal with the bitterly disappointed Comaneci -- won the uneven bars with a generous 9.9 that was loudly hooted by the crowd. Gnauck lost her balance on her dismount, and the high mark brought an official protest from Romanian coach Bela Karolyi, who thought the gold should have gone to silver medalist Emilia Eberle of Romania. Third came the beam, Comaneci's best apparatus, but she wobbled a couple of times, and nearly fell. It was not vintage Nadia, and when Shaposhnikova followed, needing a 9.95 for the gold, she was brilliant. A single-handed handstand brought spontaneous "Bravos" from the crowd, and when Shaposhnikova dismounted to rhythmic applause, gave a characteristic snap of her ponytail and waved to the adoring crowd, it was evident she thought she had won.

But it was intrigue time again. Her score was not posted until after a six-minute delay, characterized by arguing among the judges. This was reminiscent of the chaotic scene of the night before, when Comaneci's decisive score on the beam was not made official until after a passionate 25-minute wrangle, with much screaming, handwringing, and finger-pointing.

Shaposhnikova's score was finally posted as 9.85, and there was bedlam in the arena, a cacophony of derisive whistles and disapproving slow hand claps. Shaposhnikova -- the tiny 19-year-old who looks and sounds like a girl of 12, but has been described by her coach as being "prickly as a hedgehog" -- was not happy. Her face took on a Siberian scowl that could have frozen a KGB agent.

In fact, the only really radiant countenance at this moment belonged to Maria Simionescu, the head judge who had argued Thursday for Comaneci's final score to be raised and refused to punch it into the computer when it was not.

She was obviously boosting her Comaneci again, and trying to downgrade Shaposhnikova. At one point, she got up and went to the desk where the appeal jury sat, waving a sheet of paper. Moments later, she ran back to her chair, smiling with self-satisfaction, and shook hands with another judge. Her severe Romanian smirk left no room for doubt that Shaposhnikova was about to be declared a loser.

Finally came the floor exercises. Comaneci, the grim-faced sprite who had captivated Montreal as a pigtailed 14-year-old, was particularly bouncy tonight as she danced and tumbled to the tune of "Jamalaya." This may have been her swan song to international gymnastics, and when she finished her 84-second routine, she gave a rare smile. There was more audience dissatisfaction as her score came to the board as only a 9.9.

The stage was set for Kim, and she had the crowd clapping rhythmically during her floor routine. This may also have been her grand finale, and she wanted to make it memorable, but she stumbled on her concluding backward double-somersault, just as she had Thursday night.

Surely, she would be penalized, it seemed. But a savvy American in the audience said, "I bet they give it to her anyway. Everything is pointing in that direction."

He was right. To widespread disbelief, her score came up 9.95 -- the highest floor exercise mark of the night, and just good enough for the gold.

But between the final routine and the presentations, Comaneci's score was changed on the electronic scoreboard. Officials said this was because of an equipment error that had incorrectly downgraded Comaneci in the first place. But observers of the whole bizarre sequence of the evening's events figured it was just the Communist way: Share the wealth and reward the loyal model citizens.

The Soviets -- who have the current International Gymnasts Federation president, Yuri Titov, and a perhaps inordinate influence on Eastern bloc judges -- may well have sensed that they owed the Romanians one after Thursday night's disputed decision, which was staunchly defended today by gymnastics officials as fair and correct but condemned in near-hysterical fashion by Romanian coaches and media.

Karolyi, the bear-like Romanian coach who is notorious for baiting and intimidating officials, charged that there had been "an arrangement" to assure that a Soviet won the all-around title.

In the Romanian capital of Bucharest, the Communist Party newspaper Scienteia headlined, "They stole her gold medal. Nadia is still the best."

The newspaper editorialized: "The heart bursts the chest. Before Nadia's mark was announced, Davydova got on the platform and happily greeted the public. Why? Nadia's mark was still under discussion."

Romanian television's chief sports commentator, Christian Topescu, concluded his report on the debacle by giving it, in effect, his "boo of the week." Railed the infuriated sportscaster: "The best comment is no comment. wI have poisoned myself."

Karolyi charged that Ellen Berger -- the East German who serves as president of the women's technical committee for the International Gymnastics Federation -- had ordered Comaneci's score in the beam lowered.

Berger refuted this accusation today, saying that the marks were not changed, and the sole cause of the tempestuous scene Thursday night was Simionescu's futile ranting, on behalf of Comaneci. Nevertheless, the official Romanian government newspaper wrote of Berger:

"That woman with her kisses, she and other colleagues of hers cynically and without pangs of sorrow, forgetting that several days ago they took the Olympic oath of impartiality), stole Nadia's happiness for which she toiled honestly with the pure soul of an adolescent girl."

Berger, in an interview with three American reporters today, said Karolyi had lied when he said two judges had given Comaneci 10s for her routine on the beam Thursday night, and two had scored 9.9s.

In fact, she said, the marks were a 10 (from the Bulgarian judge), a 9.9 (Czechoslovak), and two 9.8s (Pole and Russian. In gymnastics, the high and low scores are discarded, and the two in between are averaged. Thus, the 10 and one 9.8 were thrown out, and Comaneci was given 9.85 -- the average of the remaining two marks.

No marks were changed by her or by the appeal jury, said Berger -- a matronly and eminently likable woman with gleaming gold teeth who has been judging gymnastics for 30 years.

She said she was "absolutely satisfied" that the marks were fair and accurate, and she sounded like a woman with a clear conscience. If she had been doing the judging herself, she said, she would have given Comaneci only a 9.8.

I like Nadia. She is a very good gymnast and a good sport, and I sympathized with her," said Frau Berger, who kissed Comaneci after all the furor on Thursday. "But her form was not as good as in Montreal. There she was absolute, the best. Now, in 1980, there are other gymnasts as good as Comaneci. Gnauck was as good, Davydova better."

Berger loathes Karolyi, whom she calls "a very bad sport who tries to win unfairly."

She also had harsh words tonight for Simionescu. "It is impossible, her attitude," said Berger. "I can't understand her behavior. When you are working at an international level, you have to remain above nationalism."

Considering tonight's follies, the key to judging gymnastics appears to be regional diplomacy. The theme: keep all the comrades happy.

The men's gymnastics suffered more than the women's from the boycott by about 50 nations in protest of the Soviet invasion of Afghanistan. Almost all the best women gymnasts are East Europeans, but the men's field was hurt badly by the absence of the United States, Japanese and Chinese teams.

Nevertheless, there were some memorable performances. Magyar, the 26-year-old Hungarian who was making his last appearance before retiring, won the pommel horse with a perfect 10. He is unbeaten on that apparatus since 1973, having won 12 gold medals in Olympic, World, and European championship competitions.

Dityatin, the extraordinarily strong and graceful Soviet, finished with eight medals: three gold (all-around, rings, team), four silver (vault, parallel bars, horizontal bar, side horse), and one bronze (floor exercises).

Dityatin thus set the record for the most medals won by an individual since the modern Olympics began in 1896. American swimmer Mark Spitz won seven golds at Munich in 1972, and Adrianov won a total of seven (four gold) at Montreal in 1976.