A massive military exercise in the mountains southeast of here today that was meant to display South Korean firepower also provided a glimpse of some of the tensions and insecurities gripping this divided nation.

With South Korean President Chun Doo Hwan and U.S. Secretary of Defense Caspar W. Weinberger looking on from a hilltop bunker across a valley, Korean troops, tanks, artillery and jet fighter-bombers--with help from American helicopter gunships and jet fighter-bombers--pulverized and "captured" a mountainside infested with an imaginary enemy.

It was an impressive military performance, a small part of a two-month-long Korean-American exercise called "Team Spirit" that eventually will involve 157,000 troops and is said to be the largest such exercise in the noncommunist world.

Near a viewing stand for television crews closest to where the tanks were streaming across the valley, however, security guards with hand-held antitank weapons stood at the ready, presumably in case any of the tanks turned its guns toward the president's bunker or the open reviewing stand that housed hundreds of invited dignitaries.

All around the hilltop viewing area and the steep, wooded paths leading up to it, scores of plainclothes security men kept one hand inside long blue canvas bags that contained automatic weapons. Metal detectors like those found at airports were carted up the mountainside to check visitors, who already had been screened before being flown into the area.

Chun watched the elaborate, hour-long display from behind bulletproof glass in a sandbagged, concrete, double-decker bunker that was specially built for the occasion and that was dubbed "the royal box" by some American officers.

The security was, in part, understandable. In October 1979 Chun's predecessor, Park Chung Hee, was assassinated by the then-chief of the Korean Central Intelligence Agency. Just 50 miles to the north, a well-armed and militant North Korean government is regarded as an ever-present menace and potential attacker. Furthermore, all the thousands of shells, rockets and bombs let loose today were real.

Nevertheless, the extraordinary security surrounding Chun and certain aspects of the event itself seemed to reflect a concern here for security and a sense of militancy much greater than that seen in other allied capitals.

Spread out in front of Chun's picture-window bunker was a 20-yard-long painting of the opposing mountainside battlefield. On both sides of the painting, ramrod straight Korean soliders with 10-foot pointers moved small tank replicas to show how the battle plan was proceeding, while drawings of maneuvers slid up and down on giant metal rails to the side.

At the close of the exercise, a huge American B52 bomber from Guam swooped low over the valley in an apparent symbol of the U.S. nuclear punch that could top off any conventional defense of the South if the North attacks again as it did more than 30 years ago.

Earlier in the day, at the conclusion of the annual U.S.-South Korean security consultative meeting in Seoul attended by Weinberger and Defense Minister Choo Young Bock, a joint communique specifically called attention to American nuclear protection, which some diplomats say is also unusual with respect to most other countries.

The communique said Weinberger "confirmed that the United States' nuclear umbrella will continue to provide additional security to the Republic of Korea."

In addition, the communique revealed that both countries had signed an agreement that would expedite turning over to the Koreans in an emergency about $2 billion worth of war-reserve stockpiles owned by the United States but stored in South Korea. At a press conference afterward, Weinberger called this an important, "unique agreement. We don't have this kind of agreement with any other country," he said. The significance, he said, was that it was another step to increase the immediate combat readiness of South Korea and to send a signal to North Korea.

This new agreement, plus the big military exercise, the reference to nuclear weapons and the visits by Weinberger in recent days to the demilitarized zone between the two countries all appear to be part of a strategy to portray powerful, American-backed, South Korean strength as the key to deterring any new adventurism from the North.

The general assessment of U.S. specialists here, however, is that while North Korean military strength has grown in recent years, the threat of a new war is probably no greater than in the past.

The two defense ministers, in a nod toward a more peaceful settlement of North-South problems, also said in the communique that such a lasting peace, easing of tensions and atmosphere for national reconciliation should come through a dialogue between North and South. Weinberger expressed his support for proposals for such reconciliation put forward by Chun last January.

One reason that Seoul is a little more tense these days, Koreans here say, is that the booming economy has slowed considerably in the past two years while Seoul's international debts have grown very large.

As one way of improving the situation, the South Koreans are putting heavy pressure on Washington to allow their large weapons manufacturing industry to sell more arms to third countries. The problem is that many of the arms manufactured here are produced under American license, and the Pentagon thus far has declined to provide any blanket authority to the Koreans.

Rather, Weinberger is insisting that each sale be assessed on a case-by-case basis and that guarantees be received from recipients that arms will not be passed along to other countries. At his press conference, Weinberger acknowledged that unemployment problems in the United States also were a factor.