Gold prices turned in a roller-coaster performance yesterday, first plunging below the $500 mark in markets all over the world, then rising sharply on news that the Soviet Union for the first time had accused Polish trade unions of undermining the authority of the Polish Communist Party.

Gold climbed to around $516 an ounce in New York in what was described as a "wild, last-minute rally" just before the close.Earlier in the day, it had retreated to $485 when buyers apparently concluded that their money would do better in any one of many high-interest yielding investments. The close was up from $507.50 on Wednesday.

Meanwhile, the dollar continued to turn in a strong performance, hitting a 2 1/2-year peak against the mark and Swiss franc as well as a new high against the lira.

Almost exactly a year ago -- on Jan. 21, 1980 -- gold-buying fever was at a peak, pushing the price to a record $850 an ounce. It collapsed from that high mark when interest rates soared, to go below $500 on May 1, 1980. Then prices turned around and moved over the $700 level on the outbreak of war between Iran and Iraq. The price has been slipping fairly steadily in the past several weeks as interest rates in the United States returned to the record levels of early 1980.

But after market experts who had been bullish on gold told their clients that prices would slump further, the news of worsening tensions in Poland yesterday broke late in the day -- and gold proved once more that in times of crisis or uncertainty there is always a speculative demand for it.

Washington Post correspondent Kevin Klose reported from Moscow that a Tass news agency dispatch from Warsaw was "the most direct denunciation" of the independent Polish trade union movement since it gained official status in Poland last year.

But Reagan administration officials continue to believe that despite yesterday's late-afternoon price reversal, the longer-term gold price trend is down.In a telephone interview, Treasury Undersecretary-designate Beryl Sprinckel said that the recent sharp slide in gold prices reflects an understanding in financial markets that "Reagan means business" in his determination to end inflation.

"If that's not impacting markets now, I expect that it will over the next two years," Sprinckel said. An economist who had been with the Harris Bank in Chicago, Sprinckel will be in charge of international financial affairs at the Treasury.

International monetary expert Edward M. Bernstein observed that "it was nonsense that drove gold to $850 an ounce in the first place." He pointed out that in relation to other commodities, gold at that level was three times as high as it had been in the panic of 1893 or the 1934 depression.

Predictions of a slide in gold generally were tied to the near-record level of interest rates in the United States. Gold carries no interest payment -- in fact, it costs money to insure and store it.

Thus, anyone who buys gold at $500 an ounce, passing up interest rates on other investments approaching 20 percent "is giving up substantial current income in expectation of appreciation in the gold price," New York economist Henry Kaufman said in a telephone conversation.

Other factors cited for diminished interest in gold relate to abatement of some tensions abroad. For example, the release of the 52 U.S. hostages by Iran appears to have eased Middle East pressures. And the fact that some increased oil supplies have begun to emerge from both Iran and Iraq is taken as a good sign as well.

At the close in Zurich, gold had lost $29 to finish at $494.50 an ounce against Wednesday's $523.50. In London gold dropped to $490.50 at the close (about noon New York time) for a $34 loss on the day.

Silver rallied to $13.95 from $13.40 the previous day and from $12.90 earlier in the day.

The dollar hit a record in Milan of 991.80 lira, up from 988.30, and it went to 993.50 in New York. United Press International said Milan sources are predicting a 1,000-lira dollar within a few days. Other European closing rates with late New York prices in parentheses: Frankfurt, 2.0925 marks, up from 2.0855 (2.0995); Zurich, 1.9005 Swiss francs, up from 1.8788 (1.9020); Paris, 4.8225 francs, up from4.7975 (4.8390); and Brussels, 33.645 Belgian francs, up from 33.52 (33.55).

In London the pound fell to $2.3975 from $2.4090 and was trading at $2.3985 in New York.