Soviet leader Mikhail Gorbachev launches a two-day visit to India today amid regional political shifts that could alter close ties between two old friends. The Gorbachev visit, the second in two years, comes as the Soviet Union is trying to pull out of its nine-year war in Afghanistan and is courting better relations with communist rival China, India's bitter foe.

In November 1986, Mr. Gorbachev stopped in New Delhi seeking reassurance that Prime Minister Rajiv Gandhi's Western leanings would not cool Indian-Soviet friendship.

Today, Mr. Gandhi himself wants to break the bitter stalemate with China and plans a December visit to Peking. Officials in his government harbor misgivings that Soviet overtures to China and the Soviet President's ambitious plans to reduce tensions with Asian neighbors will leave India sitting on the regional sidelines.

``Indian and Soviet relations are becoming more complicated because of Gorbachev's new thinking,'' says Bhabani Sen Gupta, an analyst at New Delhi's Center for Policy Research. ``India wants to keep in step with Gorbachev's policies in the region and stay on par with China, Japan, and other countries.''

For years India and the Soviet Union have found their interests in sync. As India's largest weapons supplier and a major trading partner, the Soviet Union has channeled massive aid to the subcontinental giant.

As a leader of the ``nonaligned'' third world, India has lent its backing to Moscow's war in Afghanistan - which is opposed by the United States, neighboring Pakistan, and China. India has also forged strong links to Vietnam and is the only non-Soviet-bloc country to recognize the Vietnamese-backed government in Cambodia. China supports Cambodian resistance groups fighting the Phnom Penh regime.

India also confronts China in a bitter dispute along its northeast border. China defeated India in a 1962 war in the region which has been a continuing source of tension between the two countries.

Political observers do not expect any breakthrough on the border issue when Gandhi goes to Peking. He will be the first Indian leader to do so since his grandfather, Jawaharlal Nehru, went in 1954.

But Indian and Chinese leaders could set up a framework for more serious talks on the disagreement analysts say. Plus, India is hoping that improved links with China could act as a check on rival Pakistan, with which it has fought three wars since 1947.

``If India can build up its clout, the Chinese may be willing to put some pressure on Pakistan,'' says an Asian diplomat in New Delhi. ``Still India thinks the Soviets should move more slowly with China, and the Soviets think India should move faster.''

And with prospects growing for a Moscow-Peking summit next year, India is worried it will take a back seat in Soviet foreign policy.

New Delhi also is uneasy about Afghanistan, after Moscow recently criticized its client regime in Kabul.

Earlier this year Gandhi, who fears that the a strongly Islamic government in Kabul will foster Muslim fundamentalism in the region, gave a warm welcome in New Delhi to President Najibullah who governs Kabul under growing threat from resistance fighters.

During his visit the Soviet leader also plans to shore up his country's lagging economic relations with India. As Indians have turned their sights to Western technology in recent years, the two countries' longstanding rupee-ruble trade has become imbalanced in favor of India.

In a move to raise Indo-Soviet trade to $5 billion next year, Moscow plans to sell India two 1,000-megawatt nuclear reactors valued at more than $3 billion. The deal, India's largest foreign purchase ever, is seen as a boost to its struggling nuclear power program as well as a vote of confidence for the Soviet Union. The Soviets have not sold a nuclear plant since the Chernobyl disaster in 1986.

The sale has been controversial in India, which prides itself on economic self-reliance and developing its own technology capability. The reactors, which will be fueled by Soviet-supplied enriched uranium, also have raised fears of dependence on foreign sources. Those stem from fuel cutoffs by the US and Canada after India exploded a nuclear device in 1974.

To quiet Indian worries, the Soviets have agreed to unusual safeguards which will give India a measure of control over the fuel. However, those provisions have raised eyebrows among some Western diplomats, who fear the Soviet concession could weaken control set up under the Nuclear Nonproliferation Treaty. India has refused to sign the treaty and is an outspoken critic of it.

``There are concerns that the Soviets are setting the precedent which could loosen NPT control,'' a Western diplomat says.