China secretly hosted a visit earlier this month by the controversial son of North Korean leader Kim Il Sung in an apparent bid to bolster Chinese influence in that strategically important Communist nation, according to diplomats.

China and the Soviet Union, which compete for influence in North Korea, previously have shied away from the son, Kim Jong Il, who has been named by his father to succeed him as president. Peking and Moscow officially condemn nepotism in their own ruling ranks and are hesitant about sanctioning what is envisioned as the first Communist dynasty.

Peking, however, is said to have overcome its doubts by hosting the younger Kim from June 1-12. Diplomats, who have received official confirmation of the visit, said Kim was seen boarding a train here surrounded by Chinese leaders.

China's official media did not publicize the visit, apparently to avoid domestic political embarrassment. Peking rails against the kind of unchecked power wielded by the elder Kim.

The precise reason for and itinerary of Kim Jong Il's visit remain unknown, but diplomats said Peking clearly intended it to curry favor with his father, who has artfully balanced China and the Soviet Union against each other for decades.

The elder Kim, 71, reportedly had sought a trip to Peking for his son, 41, to help legitimize his succession. Kim, however, has not announced a date for his retirement.

"The Chinese held their nose and laid on the hands," said a European envoy.

Peking's blessing is expected to cement its ties with President Kim, who has been tilting toward China since it gave him a lavish reception here last fall, presented him a gift of at least 20 newly built MiG21 jet fighters and sharpened its criticism of U.S. troops in South Korea.

China, which sent troops to fight alongside Kim's Army during the Korean War from 1950 to 1953, had been losing favor in Pyongyang since Mao Tse-tung's death in 1976.

Mao's pragmatic successors reportedly angered Kim by normalizing relations with the United States, Pyongyang's bitterest foe, which backs the rival South Korean government in Seoul with troops and weapons. Peking deepened Kim's suspicions by allowing third-party trade and unofficial contacts with South Korea.

Kim also is said to have been put off by the pragmatists' repudiation of the cult of personality surrounding Mao. Kim, who is known by his people as "the great leader," is the object of hero worship in North Korea.

As Moscow began gaining influence, however, the Chinese leadership suddenly shifted policy toward North Korea, which border's China's Northeast near the Soviet Far East.

Within the first half of last year, China's premier and defense minister visited Pyongyang, both attacking U.S. troop presence in the divided nation. Communist Party General Secretary Hu Yaobang and paramount leader Deng Xiaoping secretly traveled to Kim's capital in April 1982 to celebrate his 70th birthday.

Peking tentatively began endorsing Kim Jong Il last July, when Politburo member Xi Zhongxun toasted the heir apparent at a banquet in Pyongyang.

Moscow has thus far refused to give its imprimatur to the dynastic transfer of power in North Korea, according to diplomats.

The younger Kim's visit apparently was arranged in late May when Chinese Foreign Minister Wu Xueqian traveled to Pyongyang. Wu arrived a few days after Peking had its first official contacts with Seoul to handle the hijacking of a Chinese jet to South Korea.

Diplomats say Peking may have used the visit to promote moderation on the Korean peninsula. The younger Kim, who has no known diplomatic experience, is considered a hard-liner on South Korea who may favor an early military effort to reunify the country.

China, while publicly pledging to support North Korea should war break out with the South, privately opposes fighting that could invite instability on its northeastern flank.