MOSCOW, AUG. 24 -- After more than two years of personal and political rivalry, Soviet President Mikhail Gorbachev and Russian republic President Boris Yeltsin have formed an alliance of mutual benefit and dependence that has led to one of the more promising periods in the history of Soviet reforms.

While Yeltsin brings to the alliance extraordinary popular support, Gorbachev provides Yeltsin with even greater legitimacy and scope, both with Soviet intellectuals and foreign leaders. Together they appear set to introduce, after endless attempts, the country's first coherent package of radical economic reforms, a set of laws and decrees intended to leave behind the Bolshevik legacy of centralization.

On the streets and in the stores, the economic situation gets grimmer every day: In the past few weeks, Muscovites have staged more than 100 "tobacco rebellions," smashing store windows and stopping traffic to protest the lack of cigarettes. At the Riga Market, black marketeers charge 3 rubles for a container of partly smoked cigarettes. Shopping for basic foodstuffs is still an Olympian quest. One neighborhood outside the capital has even adopted a plan to ration bread.

No one, least of all Yeltsin and Gorbachev, expects the shortages and the growing dominance of black market dealers to disappear in just a few months. But there is an emerging consensus about what needs to be done to stabilize the situation, to end decades of inefficiency and xenophobia, and to move toward an integrated market system.

The Russian republic will introduce new laws early next month allowing, for the first time since the Bolshevik Revolution, private property and the sale of real estate to foreigners. In order to avoid a rash of land speculation, however, landowners will not be able to resell land privately but will have to sell back to the state, at least for a three- or four-year transition period.

The republic's legislature is also expected to pass measures attempting to protect the investments of foreign companies and to create cooperative and commercial banks. The plan has such widespread public support that it is likely to become the model of radical economic reform for the entire country.

"Yeltsin has helped Gorbachev become more radical in his thinking and actions, no doubt about it," said Russian Prime Minister Ivan Silayev in an interview.

"It's a nice thing to watch, almost like a contest between Yeltsin and Gorbachev over who can be more progressive," said Sergei Kovalyov, a former political prisoner who now heads the human rights committee in the Russian legislature.

The likely ideological and political loser in this equation is Prime Minister Nikolai Ryzhkov, whose far more conservative plan for economic reform appears destined, after just a few months of existence, for the dustbin of history. Ryzhkov's plan, which featured sharp rises in food prices, the preservation of numerous central planning ministries and a great deal of confusion, set off a wave of panic buying and a great deal of hand wringing in the leadership.

In a recent issue of Commersant, a weekly business magazine, a front-page cartoon shows the huge hands of Gorbachev and Yeltsin moving toward one another as if to shake, and the figure of Ryzhkov, an imperiled look on his face, trapped in the middle, waiting to be squeezed. Ryzhkov has acknowledged that he may be forced to resign.

In the town of Arkhangelskoye, outside Moscow, groups from the 15 republics and the national government have been debating and working on economic reform packages. Ryzhkov appears the odd man out. Gorbachev and his advisers in the presidential cabinet appear to have agreed to Yeltsin's concept of a 500-day plan for stabilization and widespread denationalization. Sources said that Gorbachev has also come around, after years of hesitation, to the acceptance of private property as an essential part of the new system.

"Ryzhkov is trying to hang on to all his centralized ministries, and everyone else wants to get rid of them. Ryzhkov is fighting for his vision of retaining a Soviet Union with centralized economic means, but he is losing," said Andrei Fyodorov, one of the Russian prime minister's key economic advisers.

Gorbachev, who is not above the personal battles of politics, originally campaigned hard against Yeltsin's political resurrection after Yeltsin was fired from the Communist Party leadership in 1987. Despite the party's attempts to discredit Yeltsin -- and Yeltsin's own sometimes buffoonish behavior -- his resurrection was meteoric.

First, Yeltsin won nearly 90 percent of the vote to become Moscow's citywide deputy in the national legislature last year. Then, last spring, as Gorbachev met with President Bush in Washington, Yeltsin won a narrow election to become the head of Russia, by far the Soviet Union's biggest republic.

Since then, Gorbachev has made amends with Yeltsin, and Yeltsin, in turn, has made every effort to look less like a bumptious populist and more like a statesman. He has surrounded himself with excellent advisers, toured the numerous trouble spots of the republic and succeeded in passing a sovereignty declaration that pushed Gorbachev toward moving faster on the adoption of a new treaty governing the relations of the republics with Moscow.

Yeltsin's tour, which has received respectful coverage nearly every night on the state-run evening news program, has been triumphant, a marked contrast to Gorbachev's more staged journeys throughout the country.

In the coal fields of Siberia and the polar north, where strike committees hang portraits of Yeltsin instead of Gorbachev on their office walls, Yeltsin asked for, and appeared to win, a one-year "credit of trust." In the eastern regions of Sakhalin Island and Nakhotka, Yeltsin spoke convincingly of enriching Pacific port cities by encouraging foreign trade. In his home city of Sverdlovsk, he was Boris the Green, speaking out against the "industrial filth" that has ruined the air and waters of the Ural Mountains region.

Gorbachev's alliance with Yeltsin has its limitations. Soviet politics is in such a state of flux that no one knows whose territory is whose, and the Kremlin and the Russian government have already clashed over some huge business deals. When the Soviet government announced that it had made a $1 billion deal to sell Russian diamonds to DeBeers, the leadership of the Russian republic said the deal was off unless Russia decided to approve it. Gorbachev, for his part, decreed Thursday that Russia's claim to control its own resources was illegal.

But compared with some of the pitched political battles of the past five years, Gorbachev and Yeltsin have arrived, through circumstance and savvy, at a point where, in Silayev's words, "You could say they need each other."