India and China today agreed to work toward a settlement of the longstanding border dispute that hs bedeviled relations between the two Asian giants for more than two decades.

Freely acknowledging "differences" in their perceptions of the international scene, both said these should not stand in the way of improved relations between the world's two most populous nations.

The announcement that India and China would pursue a border settlement came after three days of talks here by Chines Foreign Minister and Vice Premier Huang Hua, the first high-ranking Chinese official to visit India since then-premier Chou En-lai called on Indian primne minister Jawaharlal Nehru in 1960.

Two years after that visit, the two nations went to war over their border dispute, and efforts to improve relations since then have made little progress. d

Huang has been meeting here with Indian Foreign Minister P. V. Narasimha Rao, and this morning he met with Nehru's daughter, Prime Minister Indira Gandhi.

Gandhi, who said she had accepted a Chinese invitation to visit Peking, said China had made no specific proposals to resolve the border issue.

"The agreement is to talk about it," she said after her visit from Huang.

Huang said the two countries also agreed to boost cultural, scientific and technologicl exchanges and to expand their trade, now a two-way flow of $100 million a year. An Indian delegation is to visit China this fall for follow-up talks.

Indian government spokesman J. N. Dixit said that although both countries have "differences of assessment and approach" they agree that "these differences need not stand in the way of improved Sino-Indian relations."

Sino-Indian relations, still marred by the loose ends of their 1962 border clash, are also complicated by the increasing rivalry of the two superpowers, the United States and the Soviet Union, on the Asian and world stage.

India is linked to the Soviet Union through a 1971 friendship treaty and close trade, defense supplies and industrial ties, and China has been moving closer to the United States.

Speaking yesterday in the northern city of Lucknow, Gandhi underlined what she called "ideological differences" between the two nations, saying that India did not hold any one superpower responsible for world tensions.

She apparently referred to China's frequent criticims of Soviet "expansionism" as a major source of global instability. On one Indo-Chinese bone of contention, the Soviet occupation of Afghanistan, for example, Gandhi has explained the Soviet move as a reaction to U.S. activities in the region, while China has called it Soviet "hegemonism."

On Friday, Gandhi repeated her previous warnings of "dark clouds of war" hanging over the world. She also hinted at an impending arms race in the region, warning that if neighboring Pakistan continues to acquire arms, "we shall also have to purchase arms to defend our frontiers and hard-won freedom."

China has close ties with Pakistan and previously has supplied it with weapons; the United States and Pakistan have agreed recently on a $3 billion five-year package of military credits and economic aid. India, which has fought three wars with Pakistan in less than 34 years of independence, maintains that arms supplied to Pakistan inevitably have been turned against India.

Both Huang and Rao sounded a theme of concern about the superpower rivalry in speeches and discussions.

Reding yesterday from a carefully worded statement, the Indian spokesman said that the two foreigtn ministers "took note of the negative implications of great power rivalry on the regional and world situations." The envoys believe that international efforts to relax tensions in the world, "especially so in Asia," should be continued, Dixit related.

India and China exchanged ambassadors in 1976, after a gap of 14 years, but two previous attempts to get talks going at the foreign minister level fizzled.

China's lightning strike into India in 1962, and its abrupt pullback a month later afterunilaterally declaring a cease-fire, left the Indian armed forces in humiliation and Nehru's long-nurtured Indo-Chinese friendship policy in shreds. India also lost 14,000 square miles of territory in its northernmost state Jammu and Kashmir. China has occupied the area, known as Aksai Chin, since then, regarding it as a vital link between Xinjiang Province and Chinese-occupied Tibet.

The other disputed border area is approximately 36,000 square miles of India's northeasternmost state, Arunachal Pradesh. The area is on the Indian side of the McMahon line, a boundary drawn by British colonial administrators in 1914 that China has never recognized.