A top-ranking Norwegian military officer said today his country's Navy could have destroyed Soviet submarines that he accused of entering territorial waters this spring, but chose not to do so for political reasons.

Brig. Asbjorn V. Lerheim said it is easier to wreck a submarine than to force it to the surface, which is what the government here chose to attempt. Norwegian detection of a submarine, following Swedish charges of similar Soviet incursions, was an embarrassment to the U.S.S.R. and a mystery to Western analysts, who say they are still trying to decide what the Soviets' purpose would have been.

"It is a tough decision," Lerheim said. "It is still peacetime, and you can't really destroy a submarine . . . it is not an attack on Norwegian soil."

The general's remarks came during a visit to military installations here by Secretary of Defense Caspar W. Weinberger, who said he wanted to underscore the increasing strategic importance of Europe's northern flank. Norway shares a 123-mile border with the Soviets, and its western coastline is considered a key to controlling the North Atlantic during a conflict. Army Brig. Lerheim is commander of one of Norway's four northern defense areas.

"We know these violations have taken place," Weinberger said about the submarine reports, "and we also know that the defenses are being tested in a variety of ways throughout the NATO area."

Many Norwegians, who have a long history of edgy relations with their Russian neighbors, react with ambivalence to the Reagan administration's characterizations of the Soviet threat. There is a vigorous anti-nuclear movement here, which organized some small protests of Weinberger's visit.

Norway allows no nuclear weapons or foreign troops on its territory, and the Norwegian parliament endorsed NATO's decision to put nuclear intermediate-range missiles in Western Europe last year by one vote.

But Norway is also more supportive of its armed forces in general than some other North European countries, according to polls. The current conservative government showed enthusiasm for Weinberger's visit.

Norwegian military officials said today that Soviet Backfire bombers have been probing farther south along their coastline in the last two years. But it is the long Norwegian coastline, with its deep fjords where subs can hide, that analysts regard as crucial.

The Norwegians have a difficult time identifying subs because the water is deep and the mixture of salt and fresh water complicates sonar detection.

Some officers speculate that the subs are on training missions. Others suggest the Soviets would like to operate their ballistic-missile subs, 60 percent of which are now based in nearby Murmansk, in the Norwegian fjords in the event of war.