Panamanian President Artides Royo left Washington yesterday with the "promise of the administration that the United States will fulfill its commitments" under the Panama Canal treaties, and deep concern over President Carter's ability to deliver on that promise.

Should proposed House amendments that Panama considers violations of the "spirit of the treaties" be attached to their implementing legislation, Royo said, "nobody knows how the Panamanian people will react."

In the event of anti-American protest riots similar to those in the U.S. Canal Zone in 1964, he said, "I would be out in front of my people."

Royo stopped here for a three-day visit on the last leg of a trip that took him to Spain, Italy and France. In talks with the administration and Congress, he sought to outline problems Panama has with aspects of the amended legislation, which elaborates on the treaties that go into effect Oct. 1 and appropriates funds for them.

At the same time, Royo sought reassurance that those problems would be resolved. In a meeting with Carter and top adminsitration officials Thursday, sources said, Royo handed over a list of what Panama would consider legislative "violations" of the "spirit of the treaties," including restrictions on annual canal profits paid to Panama and increased U.S. control over a canal commission authorized in the treaty.

The amendments emerged as part of unexpectedly heavy anti-treaty sentiment in House committee hearings. They will be debated, along with original administration implememting bill, or the House floor beginning within two weeks.

The legislation is expected to be hotly contested even with the restrictive amendments but, according to one administration source, the White House will try to get the bill through the House and worry about deleting some of the more objectionable portions of the amended version later in the Senate and in conference.

Asked at a press breakfast yesterday if he had been reassured by his visit here, Royo said, "We want to trust in the honor of this nation . . . I get the promise of some people in the (House), in the Senate, and the promise of the administration of this country that the United States will act in accordance with the spirit and the letter of the treaties."

According to one high-level Panamanian source, however, Carter's domestic problems, especially Thursday's House defeat of an administration gas rationing standby plan, have not been lost on Royo.

Royo's public attitude during the visit was one of confidence and firmness. In a number of speeches before congressional committees and policy groups, he portrayed Panama as a nation that is not begging from the United States and expects to be treated as equal.

At the same time, Royo wanted to show himself in control of his own country, despite the role former head of state Gen. Omar Torrijos still plays as head of the Panamanian military.

Treaty opponents have charged that Torrijos is sending arms to Sandinista guerrillas in Nicaragua, and while Royo denied that Panama has materially aided the guerrilla opposition to Nicaraguan President Anastasio Somoza, he voiced his firm support for the opposition cause.

"The moral support we give to Nicaragua," Royo said, is the support "the United States should give to Nicaragua . . . if we both believe in democracy."

He denied reports recently published in Miami that a Panamanian diplomat and military official had purchased arms there to be illegally shipped to the Sandinistas via Air Panama, the country's privately owned airline.

The allegations reportedly were made by officials of the U.S. Alcohol, Tobacco and Firearms bureau and contained in court documents filed in late April.

The diplomat in question, former Panamanian consul in Miami Edgardo Lopez, is not employed by the Panamanian military, and was replaced as consul last October, Royo said.

"Let me clarify that the government of Panama considers that the problem of Nicaragua is an internal affair," Royo said. "Maybe we people in Panama are not the most intelligent in the world, but we have enough intelligence" not to sue a government official or plane to ship arms to Nicaragua.