MOSCOW, SEPT. 16 -- Tens of thousands of protesters marched to the Kremlin today to demand the resignation of Prime Minister Nikolai Ryzhkov and immediate adoption of a plan to shift the Soviet Union to a free-market economic system.

The demonstration in central Moscow added to political pressure on Ryzhkov to step down in favor of a government of national unity that would include some non-Communists. It came on the eve of a crucial session of the Supreme Soviet, the nation's standing legislature, that is to choose between rival programs put forth to rescue the Soviet Union from its growing economic crisis.

"The stores are empty. The ruble is worth nothing. The government hasn't even succeeded in collecting what would otherwise have been a good harvest," Moscow Mayor Gavril Popov told today's rally at the entrance to Red Square, named to commemorate the 50th anniversary of the 1917 Bolshevik Revolution and long regarded as the shrine of the world Communist movement. "The machine of bureaucratic socialism has broken down."

Popov, a leading reform politician and free-market economist, and other speakers urged Soviet President Mikhail Gorbachev to break with Ryzhkov, his prime minister for the past five years, and form an alliance with radical-reform forces led by Boris Yeltsin, President of the Soviet Russian repulic. As head of state and chief of the Communist Party, Gorbachev has skillfully distanced himself from Ryzhkov's increasingly unpopular government.

A soft-spoken technocrat who emerged from the Soviet Union's vast economic bureaucracy, Ryzhkov, 60, has advocated a more cautious transition to a free-market system than has Gorbachev or Yeltsin. He appeared on television Saturday night to defend his insistence on retaining a large measure of centralized control, which he described as the only way to avoid anarchy and chaos.

The struggle between rival political factions is likely to reach a climax over the next two weeks as the Supreme Soviet debates the relative merits of Ryzhkov's program and the radical "500 Day Plan" supported by Yeltsin and, with some reservations, Gorbachev. Ryzhkov has repeatedly indicated that he will resign unless the legislature gives him its backing.

"The Supreme Soviet nominated us, and if the Supreme Soviet trusts us, the government will continue its work and fulfill its functions," Ryzhkov told Saturday's national television audience. "If it does not, the Supreme Soviet has the opportunity to take the necessary decision."

At today's rally, most speakers avoided direct criticism of Gorbachev, but the mood of the crowd appeared more radical, with some demonstrators waving banners saying, "Goodbye, Misha," and "Gorbachev, Ryzhkov and Co.: We don't believe in any of them."

Permission to hold today's protest rally next to the Kremlin walls was granted by the radical-controlled Moscow city council after a constitutional watchdog committee struck down a presidential decree banning political protests in the center of the capital. The decision reflected growing assertiveness by fledgling legislative and judicial institutions that have sprung up in the past two years.

After setting out from Gorki Park on the Moscow ring road, the estimated 30,000 to 40,000 demonstrators marched down Tverskaya Street to the red-brick Kremlin walls, chanting, "Resign, resign." Their banners read "Yeltsin -- 500 days, Ryzhkov -- 600 seconds" and "Communism is political AIDS." Formerly known as Gorki Street, in honor of the revolutionary Russian writer Maxim Gorki, Tverskaya Street is one of a number of Moscow thoroughfares that have reverted to their pre-revolutionary names.

The protesters then spilled into the huge square between the Kremlin and the monolithic gray facade of Gosplan, the state planning authority that has exercised dictatorial control over all aspects of the Soviet economy for more than half a century. Under the 500 Day Plan, Gosplan would be abolished.

"We need a society that has the ability to create wealth -- and not just distribute and redistribute it as we did in the past," said Sergei Kovalev, a former political prisoner recently elected to the legislature of the Russian republic, who was one of the demonstration's organizers.

The 500 Day Plan, which envisages rapid denationalization of the Soviet economy through sale of state assets, has already been endorsed by the Russian legislature with only a single dissenting vote. Gorbachev last week sent a modified version of the plan to the Supreme Soviet, endorsing its timetable for introduction of a market economy but proposing to allow central authorities to retain greater fiscal and monetary powers than initially recommended.

Many demonstrators today seemed to brush aside warnings by government economists that adoption of the 500 Day Plan could lead to large-scale unemployment and uncontrollable inflation.

"Things can't get any worse than they are already," remarked Enver Bliyev, a worker from the southern Soviet republic of Georgia, who said he attended the rally out of curiosity. "The Communists tell us that this will lead to price increases. But right now, the shops are empty anyway. So what advantage do we get from subsidized prices?"