Yugoslavia's President Tito, once denounced by Chinese leaders as the arch-heretic of the world Communist movement, is likely to be given a spectacular welcome Tuesday when he arrives in Peking on his first visit to China.

Tens of thousands of people, including Communist Party Chairman Hua Kuo-feng, are expected to turn out to greet the 85-year-old Yugoslav leader on his arrival from the North Korean capital, Pyongyang, on the third leg of a 15,000-mile tour that has also taken him to the Soviet Union.

In June 1958, Tito was described by the People's Daily as a "dwarf kneeling in the mud and trying with all its might to spit at a giant standing on a high mountain." Today he is being wooed by the Chinese as the leader who had the courage to resist Soviet domination.

The stubborness, pragmatism, and independence Tito personifies have evidently become more acceptable to the Chinese leaders as their dispute with Moscow has deepened, and in recent months Chinese officials have praised him for his leadership of the nonaligned world.

Tito's Asian tour, culminating in his arrival in China, is being built up by the Yugoslav media as " the event of the year." Commentators have stressed that he will be the first head of state to visit Peking since the emergence of a new Chinese leadership at the 11th Communist Party Congress earlier this month.

The visit will also mark the first direct contact between the leaders of China and Yugoslavia, the first two Communist countries to break away from the Soviet bloc.

Over the past week, Yugoslav television has been showing documentaries about life in China and Chinese feature films, while newspapers here have been full of flattering articles about Chinese achievements and radio stations have even taken to broadcasting Chinese popular music.

Yugoslav television viewers have seen Tito, looking bronzed and fit, receive a rapturous reception in Pyongyang on the last stage of the tour. At a giant gymnastics display organized in his honor, thousands of North Koreans held up colored flipboards to form an outsize portrait of him.

The Chinese are evidently preparing a similar welcome. According to reports from Peking. Rehearsals have already been held in the Square of Heavenly Peace for the most spectacular reception accorded a foreign leader since the visit of North Korea's Kim II Sung in 1975.

During Tito's 10-day stay in China, much interest will center on whether the Chineese leaders will soften their attacks on the Soviet Union. It might be embarrassing for Yugoslavia if the Soviet ambassador were to walk out of a state banquet in Tito's honor.

Some observers see Tito's trip as a kind of delicate balancing act betwen the two leading Communist powers. The Yugoslavs have already indicated that they do not want improved relations with China to jeopardize their precarious friendship with the Soviet Union.

It will therefore be interesting to see if any move is make to reestablish relations between the Chinese and Yugoslav Communist parties, broken off in 1958. Tito has been invited to China as head of state rather than as party leader - but the delegation includes Stane Dolanc and Alexander Grlicchkov, two of his top party aides.

One argument against reestablishing interparty ties is that Sino-Yugosiav relations are likely to be much smoother if they are left uncomplicated by ideological problems. At present, Yugoslav commentators do not conceal the differences of opinion between the two countries, but say that these need not be a barrier to better relations.

An ideological reconciliation between Peking and Belgrade would also infuriate Albania, once China's only ally but now increasingly critical of its former patron.

Albania has shown its disapproval of Tito's visit to Peking by issuing the text of comments made by Enever Hoxha, the Albanian leader, to the late Chinese Premier Chou En-lai in 1965. As if to remind the Chinese of what they formerly thought of the Yugoslavs, the booklet denounced the betrayal of socialism by the "Titoist revisionist clique."