President Leonid Brezhnev of the Soviet Union left for home this morning after a four-day visit that saw him use India as a platform to expound Moscow's foreign policy views to the rest of the world.

He left behind a seven-page joint declaration that failed to mention the Soviet military intervention in and continued occupation of Afghanistan, the most gnawing issue in this region, or the threatening situation aorund Poland. m

But the declaration, signed by Brezhnev and Prime Minister Indira Ghandi of India, called for dismantling all foreign bases in the area and an end to the building "under any pretect whatever" of foreign military bases in the Indian Ocean. It also supported the bid of Mauritius for return of the British-owned island of Diego Garcia, where the United States has an air and naval base.

While the joint declaration can be considered a foreign policy plus for the Soviet Union, especially since it fuzzed the differences between Moscow and New Delhi on the need to withdraw Soviet troops from Afghanistan, Brezhnev's visit was not a total success.

For the first time in a quarter-century of Indo-Soviet friendship, there were hostile demonstrations over the Afghan invasion that forced security officials to twice change the routing of Brezhnev's motorcade and to move a civic reception for the ailing 73-year-old Soviet leader from the historic Red Fort in the city's old section, where such receptions generally are held, to a modern building in the new section.

Furthermore, the Brezhnev visit drew critical press comments that are unprecedented considering how policy-makers here had trumpeted friendship between the two countries despite their differences.

This included a front-page cartoon in yesterday's respected Times of India in which Brezhnev tells Gandhi as he places his foot on a paper marked Afghanistan, "I entirely agree. There should be no outside interference and the issue must be settled internally. You see, we are always there to help them in this matter."

In the closest reference to Afghanistan in the joint declaration, Brezhnev and Gandhi agreed they opposed "outside interference in the internal affairs" of countries in Southwest Asia and said problems there "demand peaceful, practical solutions paying full respect to their sovereignty, territorial integrity and nonaligned status of the countries of the region."

The government of India considers Afghanistan as part of Southwest Asia, which also includes Iran and Iraq that are fighting a war that threatens the noncommunist world's oil supply.

Much of the joint declaration was aimed against American efforts to ensure the security of the Persian Gulf oil region from a possible Soviet threat. It called for making the Indian Ocean "a zone of peace" and supported the holding of a scheduled United Nations meeitng on the region early next year, a proposal that the United States opposes. $99[Words ommitted] end to the arms race, especially in nuclear weapons, and said nuclear weapons test and all chemical weapons should be banned.

Brezhnev did not, however, pursuade Gandhi to support the Soviet intervention in Afghanistan and he had to listen to India's president, N. Sanjiva Reddy, state his government's opposition to foreign troops in the region.

With both countries agreeing to disagree on the major war and peace issue facing this region, Brezhnev spent most of hew few public appearances here talking over the heads of his Indian hosts to deliver Moscow's foreign policy message to the rest of the world.

Included in his message were what diplomats here believed are signals to the incoming Reagan administration that Moscow is willing to discuss a new SALT agreement but that the United States should back off its opposition to the Soviet intervention in Afghanistan, which Brezhnev's spokesman Leonid Zamyatin said is a neighboring state that cannot be hostile to Russia.

The Soviet leader also unveiled "the Brezhnev doctrine" for security of the Persian Gulf which appeared to be aimed at crippling the United States pledge to ensure the security of the area.

Surprising enough to draw comment in the Indian press today, his proposal received no applause from the members of Parliament it was addressed to even though it contains many well-known elements of Indian foreign policy such as the removal of foreign military forces from the Indian Ocean.