Defense Secretary Caspar W. Weinberger confimed here today that the Reagan administration favors selling the advanced Aim9L Sidewinder missile for Swedish fighter planes, calling it one of the risks that must be taken "to maintain the cause of freedom in the world."

The Aim9L is such a key weapon for close-in aerial combat that a group of American fighter pilots objected, in a letter to the Senate Armed Services Committee, to the administration's proposal to sell the weapon to Saudi Arabia as part of the AWACS (Airborne Warning And Control System) radar planes deal.

Sweden is a neutral country only a few minutes flight time from the Soviets' Kola Peninsula, and concerns have been raised that the Aim9L might fall into unfriendly hands through a crash or unauthorized transfer of technology.

But Weinberger said, "There's always going to be a risk. We simply have to make the decision as to whether we want sales of our equipment to countries which we think share our ideals, whether we want to thereby help the defense of freedom throughout the world, or whether we want to become a self-contained island and not make any sales to anyone."

The defense secretary said that the administration will put controls on any Aim9L missiles sold to Sweden to minimize the risk of unfriendly powers getting the weapon.

"I have no doubt that we will be able to work out proper restrictions," said Weinberger in indicating that the deal with Sweden is virtually closed for both the Aim9L missile and an advanced version of General Electric's 404 engine for the next Swedish fighter plane.

The Aim9L missile would go on the Viggen interceptor aircraft already in service here.

A group of U.S. senators is opposing the AWACS sale to Saudi Arabia on the ground that it is not worth the risk of losing the Sidewinder to the Soviets or other potential adversaries. Weinberger acknowledged today that selling the Sidewinder to Sweden and Saudi Arabia is "a matter of measuring the risk."

"On balance," he said, "I would personally say that the Sidewinder missile would give the Saudi Arabian Air Force and Swedish Air Force and others who want it an ability to improve their capability of defending their own countries."