The United States has bought weapons from Egypt and has been shipping them to anti-Soviet rebels in Afghanistan for almost two years, President Anwar Sadat revealed in an interview with NBC-TV last night.

Sadat's comments, made to NBC correspondent Peter Miller in Cairo, provide the first confirmation of frequent Soviet charges that Washington was providing arms to Afghan rebels fighting some 85,000 Soviet troops as well as Afghan government troops.

In the interview, broadcast on NBC's Nightly News, Sadat said: "Let me reveal this secret. The first moment the Afghani incident took place, the U.S. contacted me here and the transport of armaments to the Afghanis started from Cairo on U.S. planes."

The Soviet Union invaded Afghanistan on Christmas Day 1979.

The Egyptian president added that the shipments will continue "until the Afghanis get rid of the Soviets."

A State Department spokesman declined comment on the report. But he said, "as we have previously noted, the bulk of the arms in Afghan nationalist hands have been obtained from indigenous sources. These include arms captured from the Soviets, from defecting or cooperating Afghan Army personnel and existing supplies in local hands."

Miller quoted a high Egyptian government official as saying that the arms are being flown directly to Pakistan. The arms which are now being shipped are Egyptian-made replicas of the Soviet originals, the report said. But it did not specify what kind of weapons were involved.

The original arms were supplied to Egypt by the Soviet Union at a time when Egypt was thought to be firmly in the Soviet camp. But Egypt expelled 17,000 Soviet advisers from the country in 1972, accusing Moscow of interference in Egyptian affairs.

Sadat, in apparent reference to U.S. aid to Egypt amounting to $1 billion annually, said in the interview that Washington had been "very generous" in paying for the weapons taken from Egyptian military stocks.