A mighty power struggle within Panama's National Guard has:
* Forced the resignation of President Aristedes Royo two years before his term was due to end.
* Raised the specter of growing unrest in the Isthmian nation that could jeopardize operation of the Panama Canal.
So serious is the situation, according to observers, that within the Reagan administration there are some suggestions the United States might have to intervene to preserve canal operation. That may be too hasty an observation, but Washington is watching developments with deep apprehension.
The US does not have an ambassador on the scene. Ambler Moss, regarded widely as one of the most able US ambassadors anywhere, is out of the country and officially steps down from his post Aug. 1. The resignation was expected as Moss is a Carter administration appointee.
Mr. Moss played a key role in the smooth transition of Panama Canal operation from US control to joint Panama-US operation under canal treaties that took effect in 1979.
The waterway is functioning smoothly at the moment. But there has been concern that Panama might move to gain full control of the canal now and not in the year 2000 as provided in the new treaties. Some elements within the National Guard, ultimate source of power in Panama, argue that the canal should become fully Panamanian now. There are numerous Panamanian civilians who agree.
One who did not, however, was President Royo. He argued that Panama should honor both the letter and spirit of the new treaties.
His support of the treaties, however, was not much of a factor in his resignation. It appears that his stubborn refusal to bring forward 1984 presidential elections to 1983 may have been the real reason for his downfall.
Gen. Ruben Dario Paredes del Rio, the new National Guard commander who wants to become president, apparently forced Royo out. The leading, although undeclared presidential contender, General Paredes last week said the ''people are keen to vote.'' He added in a speech to guard officers that Royo was politically ''worn out.''
President Royo argued that he should serve out his term, which had been set by Gen. Omar Torrijos Herrera, the late Panamanian strong man who helped engineer the new canal treaties. Royo was seen as General Torrijos's puppet, but after the general was killed in a plane crash a year ago, he began acting independently.
That inevitably put him on a collision course with the guard and with General Paredes, who is himself locked in a power struggle within the guard, although he is thought to be the preeminent guard officer at the moment. Other key officers are Col. Roberto Diaz Herrera, General Torrijos's cousin, who is the head of operations for the guard, and Col. Antonio Noriega Moreno, head of intelligence and chief of staff.