China has taken a hard nationalistic turn in its foreign policy as the Communist government seeks to bolster its domestic prestige by scoring diplomatic points.

In recent months, nationalism has been the dominant strain in an unusual diplomatic blitz in which Peking has:

* Dramatically intensified its claim to lost Chinese territory -- Hong Kong and Taiwan.

* Opened dialogues with most border states in the hope of pacifying China's hostile periphery. Everyone from the king of Nepal to a Soviet deputy foreign minister have come courting in a manner reminiscent of the days when Peking was the Middle Kingdom and foreigners mere tribute-bearers.

* Cornered Japan into once again acknowledging the crimes it committed in China during World War II.

* Demanded freer markets in the United States for Chinese textiles and other goods.

The diplomatic offensive has coincided with a skillful propaganda campaign that makes use of certain psychological levers to arouse Chinese national pride while sowing distrust and anger toward foreigners.

Politburo standing committeeman Li Xiannian set the tone for this new Chinese nationalism in a January speech in which he declared: "Our principles are not for sale, and we will not beg. We will never allow anyone to infringe upon our sovereignty, interfere with our internal affairs or impede the unification of our country."

Diplomats here cannot recall so forceful an assertion of Chinese national interests during the Communists' 33-year reign. Peking always has heeded patriotic concerns, but previously it highlighted its foreign policy with alternating currents of revolutionary ideology and ecumenical good will. The new strategy seems more narrowly conceived to reverse past humiliations while propelling China into a more influential world role.

"Enlightened self-interest is not a bad way to conduct foreign policy," observed a senior Western diplomat. "A China that is pursuing a realistic, self-centered policy is a China you can deal with."

One reason given for this more aggressive pursuit of national goals is that nationalism can be an effective tactic for achieving them, especially if they involve, as the Chinese say, "problems left over by history."

But most analysts trace the rise of nationalism here to domestic politics. Faced with disgruntled military officers, restless youth and an unmotivated work force, the Communist leadership has turned to patriotic themes to rally support.

"Communism doesn't have much appeal as a philosophy," said a Western envoy. "The party realizes its legitimacy increasingly rests on its ability to respond to the national urgings and needs of the people."

Communism triumphed in China in 1949 on a wave of nationalism after brutal Japanese invaders were driven out. A victorious Mao Tse-tung said at the time, "Ours will no longer be a nation subject to insult and humiliation. We have stood up." Party leaders struck the same popular chord this past summer while excoriating Tokyo for new, toned-down textbook versions of the Japanese occupation of China from 1937 to 1945.

Official broadcasts and newspapers played back nightmarish accounts of rape, mass murder and human experimentation committed by Japanese imperial troops, then declared that any effort to prettify the period deeply insulted Chinese national pride.

The party portrayed itself as defender of the national honor, warning Tokyo at one point that "an eruption of popular anger . . . could easily take place without agitation."

Finally, Tokyo agreed to review the textbooks to eliminate any historical distortion.

The theme of setting right past wrongs is central to the new nationalism, revealing the widespread feeling here that China has been shabbily treated and unfairly deprived of its place on the planet.

Recent demands for fewer U.S. import restrictions on Chinese products is an example of Peking's heightened defense against discrimination by big powers, said a Western diplomat.

No issue more painfully symbolizes China's past degradation than Hong Kong. Snatched by Britain in the 19th century after a series of one-sided, embarrassing naval battles, Hong Kong conjures up images of Western intrusion and China's submission to semicolonial status for almost a century.

So, it was with no lack of national pride that Communist leaders proclaimed last month their "sacred duty" to recover sovereignty over the territory, presumably after the 99-year British lease on most of it expires in 1997.

Officials have indicated that Peking is prepared to sacrifice Hong Kong's prosperity and economic importance to China -- it is a major source of foreign exchange -- for the honor of flying a Chinese flag over it once again.

"They would rather kill the goose that lays the golden egg than go down in history as the Chinese leaders who gave away a piece of Chinese territory to Western imperialists," a Hong Kong businessman said.

The issue of Taiwan is more complicated, but it still boils down first to the question of Chinese sovereignty, then one of Communist legitimacy.

After letting the issue rest for years, Peking late last year demanded an immediate halt in U.S. arms sales to Taiwan, saying they interfered with Communist efforts to reunify with the breakaway island that is ruled by old Nationalist Party foes.

Only after the United States reiterated its acknowledgment of Chinese sovereignty over Taiwan and pledged to phase out weapons supplies to the island gradually did Peking back off threats to downgrade diplomatic relations with Washington.

While strongly asserting itself abroad, the Communist government also has sought to stimulate patriotism at home and to dim enthusiasm for things foreign -- a domestic component of the new nationalism.

After the Chinese women's volleyball team beat American and Japanese squads -- victories celebrated in Peking by sometimes xenophobic street demonstrations -- the theoretical journal Red Flag recalled how foreigners once looked down on Chinese as "incapable of almost anything."

Then, the article asked, when China's volleyball team won, "how many Chinese felt proud? People can see from this that the Chinese are not a bit inferior to foreigners, that the Chinese also can be champions."

Gradually, the party moved to negative reporting. Seeking to cure Chinese of their infatuation with the West, the official media have described Occidental influence with such ominous language as "contamination," "poison," "capitalist spiritual pollution," "Western cultural garbage" and "capitalist trash."

Foreigners have been blamed for everything from retarding Chinese economic development during colonial times to inspiring last August's unsuccessful airplane hijacking.

"The enemy is using its radio stations to carry out psychological warfare, seducing and corrupting our young people with the decadent ideology and life style of the exploiting classes, imbuing them with reactionary political poison and instigating them to commit crimes," said the Shanghai Liberation Daily last summer.