Peking — ''If a friend comes from as far as one thousand li away, how can he not benefit our country?'' Thus, subtly, with a quote from the ancient philosopher Mencius, did Chinese Defense Minister Zhang Aiping greet United States Defense Secretary Caspar Weinberger.
The two had just sat down, with their staffs, for more than two hours of discussion in the Great Hall of the People. At its conclusion Mr. Weinberger set off for the obligatory trip to the Great Wall, while officials of both sides agreed the talks had been ''useful, cordial, and helpful'' and had dealt with ''the desires and needs of both sides.''
(The li is an ancient Chinese measure that might loosely be translated as a league. The modern li is one-third of a mile.)
The Zhang-Weinberger talks renew high-level contacts between the Chinese and American defense establishments after a hiatus of three years. They are another sign of a steady improvement in Sino-American relations recently despite a simultaneous warming of Sino-Soviet relations.
China today does not explicitly attack Soviet hegemonism and as General Zhang said in an extemporaneous welcome to Mr. Weinberger at a banquet Sept. 25, ''We seek and pursue a policy of independence. We will not attach ourselves to any big power, nor will we ever yield to any foreign pressure.''
But as General Zhang also said during his first formal discussions with his American guest the following morning, ''We all know from where the threat to world peace comes.'' This was after Weinberger had given a 90-minute exposition of US defense policy in response to what he called an enormous growth in Soviet offensive capacity.
The fact is, that in global strategic terms, Peking still sees pretty much eye to eye with Washington, particularly on questions such as the Soviet invasion of Afghanistan or Soviet support for Vietnamese occupation of Kampuchea. Taiwan, the only major point of disagreement between China and the US , has not come up so far, although it undoubtedly will be mentioned before Mr. Weinberger leaves China.
Besides global strategic issues, however, China has a much more specific shopping list for military and so-called dual-use technology - items such as computers that can be used for either civilian or military purposes.
According to US officials, in his meeting with General Zhang, Mr. Weinberger recalled that in June, l981, Peking had submitted a list of high technology items it wanted to buy from the US. The Pentagon considered 65 items on this list as sensitive, because of the technology involved, and agreed at that time to approve only 11 of them. This was in spite of the fact that President Reagan had designated China as a friendly though nonallied country entitled to the same kind of treatment as other nations in this category, such as India or Yugoslavia.
Pentagon reluctance to approve the transfer of dual-use technology has been an irritant in Sino-American relations since before Mr. Reagan came to office. It was only after last May, when Commerce Secretary Malcolm Baldrige brought the message here that the US would approve liberalized guidelines for dual-use technology sales, that Peking-Washington relations began to improve.
The new guidelines have yet to be announced. But the Chinese have been told of them, and Weinberger informed General Zhang that an additional 32 items have been cleared out of the 65 considered to be problems in l981. A further 11, he said, had a high chance of being cleared. Among them, American officials said, are not only dual-use items, but also some weapons.
The defense secretary is understood to be pleased at the way his visit, his first to China, has gone so far. General Zhang's comments indicate that, although China will rely mainly on its own means for military modernization, its leaders recognize the great distance that must be covered in order to achieve their goal. To the extent that Washington authorizes dual-use technology sales, and in some areas even military sales to China, the US will be helping China to achieve its goal faster.
That seems to be at least one of the meanings behind General Zhang's opening quotation from Mencius.