Ignoring violent protests by opponents who charged electoral fraud, Nicolas Ardito Barletta took office today as Panama's first elected president in 16 years.

Among dignitaries on hand for the ceremony were former president Jimmy Carter and Secretary of State George P. Shultz. Shultz said on arrival here yesterday that the occasion offered Panama "a new opportunity for progress."

The inaugural was the focus on Shultz's three-day swing through Central America also designed to promote the U.S. approach to regional peace talks.

Ardito Barletta, in his inaugural address, outlined a "crisis of alienation, lack of confidence and unrest," because of Panama's economic situation. Although outgoing President Jorge Illueca called for control of the Panama Canal to be returned to Panama in 1990 instead of 10 years later as now scheduled, Ardito Barletta vowed that the existing pact would be respected.

Security was heavy following an opposition demonstration by about 1,200 people last night who shouted that Ardito Barletta had stolen the election with the support of the national Defense Force, formerly called the National Guard.

Press reports today said 20 people were injured and about 50 arrested when police moved in at 2 a.m. with clubs and pistols. The square had been cleared and was heavily guarded this morning.

The disturbance and the circumstances surrounding Ardito Barletta's inaugural indicated that power here remains in the hands of the pro-American Defense Force, as it has since the late general Omar Torrijos seized control in 1968.

The loser then, as in this year's election, was Arnulfo Arias, now 83. Torrijos' coup ended Arias' third abortive presidential term, and Arias lost to Ardito Barletta last May 6 by 1,713 votes out of 600,000 cast after the Defense Force suspended the vote count while Arias was leading.

The 10,000-man Defense Force is gradually taking over administration of the Panama Canal as the U.S. presence phases out. There are still 9,000 U.S. troops present.

Ardito Barletta, 45, stepped down as the World Bank's vice president for Latin America to run for the presidency of Panama at the head of a coalition of six parties.

A student at the University of Chicago when Shultz taught economics there in the early 1960s, Ardito Barletta is considered friendlier to U.S. interests than Illueca.

Illueca moved up from the vice presidency early this year following the abrupt resignation of his predecessor, Ricardo de la Espriella, also a former vice president who attained the highest office when his appointed predecessor resigned.

Shultz called Ardito Barletta "a longtime and respected friend." A high State Department official in Shultz's party told reporters that Illueca had "visibly aligned himself with Third World moves not in track with U.S. views," but that Ardito Barletta "brings a more practical view" to regional conflict.

Shultz met with Illueca and Ardito Barletta, and with presidents Oscar Mejia Victores of Guatemala, Belisario Betancur of Colombia and Alberto Monge of Costa Rica.

Shultz said his talks were "quite worthwhile" and had focused on the Contadora effort to achieve a peace treaty. "We want the agreement the sooner the better."

Ardito Barletta said agreement on the Contadora "cannot be postponed. We're here to govern and not to discuss the past."

Carter got an ovation when introduced as one of the dignitaries. Others included Salvadoran guerrillas, Nicaraguan opposition leader Arturo Cruz, and Sergio Ramirez of Nicaragua's directorate.