In a symbolic visit to an American out-post that will soon become part of Panama. President Carter warned the Panamanian government yesterday to respect the rights of Americans here and appealed to the Americans to ease the transition to Panamanian rule.

A small and noticeably cool crowd of American residents of the Canal Zone attended Carter's speech at the edge of a large field on this army base on the east bank of the Panama Canal. Only about 5,000 of the 40,000 Americans who live and work here - and whose lives will be profoundly affected by the Panama Canal treaties formally exchange Friday - attended the speech.

"Everyone understands that we want to enter upon a new era of harmonious cooperation and goodwill between the people of Panama and the Americans associated with the canal, and that there is no room for bad faith in that relationship," Carter said. "It requires a hospitable and cordial attitude not only on our part but on Panama's as well."

It was not a celebration that took place here yesterday.

In some ways it was a typical American crowd, seen at countless political rallies. But it was a crowd with deeply mixed feelings, reflecting pride over what has been achieved here, but sorrow and even bitterness that the special way of life of the "Zonian" will soon come to an end.

They stood at the edge of the field, and as Carter's helicopter descended children were hoisted to their parents' shoulders and dozens of small American flags were wave in the air.

There was polite applause for the president and his wife.Rosalynn, but amid it a scattering of boos and other graphic signs of the unhappiness of the American community here.

One young man held a large poster that proclaimed, "Re-elect Carter, the best president Panama ever had." Above the slogan there was a picture of Panama's military leader, Gen. Omar Torrijos.

Many Americans here bitterly opposed the canal treaties, formally exchange Friday in the festive atmosphere of Panama City contrasting sharply with the mood here yesterday.

Under the treaties, which become effective next year, control over the canal will gradually be transferred to Panama until noon on Dec. 31, 1999, when the canal passes fully into Panamanian hands. The Canal zone, the 10-mile-wide swath of American-controlled territory that flanks the 50-mile-long canal, will cease to exist as a separate entity as soon as the treaties take effect - no later than Oct. 1 of next year.

Carter, lavishing praise on the Americans who help operate the canal, acknowledged their feelings of sadness as well.

"You know, as I do, that a great deal will change as a result of these treaties," he said. "A few of you will be leaving the only place on earth you have ever called home.That's a hard and painful thing to do."

"That's right," a woman shouted from the crowd.

But Carter also promised the continued support of the U.S. government, stressing that he expects the civil liberties of Americans to remain protected under Panamanian jurisdiction over the canal. He said he discussed this with Torrijos, adding that the United States considers the protections guaranteed its citizens in the new treaties "as a fundamental part of our agreement with Panama."

"You have brought credit to yourselves and your country by operating the canal efficiently, honestly and honorably for the benefit of all nations," the president told the crowd, as thick clouds ocassionally obscured the tropical sun.

"The time when this was America's job alone is now coming to an end," he added. "The treaties reflect that time, and in so doing, they help guarantee that the rest of the world will recognize our essential fairness and decency as a people."

In nearly Balboa, one of the Canal Zone's communities where the biggest anti-treaties rallies were held in the past, there were no organized protests against the President's visit. At the Balboa post office, one of the institutions to disappear as the canal treaty goes into effect, residents discussed their reasons for not attending Carter address.

"A lot of the military did not go because he gave amnesty to the guys that wouldn't fight in Vietnam," said one military officer stationed at Fort Amador who asked that his name not be used.

The relatively small turnout at Carter's speech was interpreted as a protest against the treaties.

"There was a big public relations effort going on here. But even the special 15-car train chartered to bring people in from the Atlantic side had only 200 people on it," one Canal Zone police offer said.

Willie Draughan, a Canal Company driver in the Zone since 1916, said he did not care "to see the president because he lied to us. As a candidate, he said he would not give away the canal when he was debating with Ford."

"I didn't go, I'm no hypocrite. Carter is not getting my vote again," said an American woman whose son, a detective, will be losing his job when U.S. jurisdiction in the zone comes to an end next year.

Many Zone residents haver already started looking for jobs in the United States. Of the ZOne's 230 policemen, for example, about 60 have found emploument in other U.S. government agencies and expect to leave in the next few months.

Many employes of customs, commissaries, movie houses and bowling alleys hope they will be hired by the Department of Defense when it takes over some of these services.

In Panama City there were no disturbances, but opposition groups were apprehensive about persistent rumors that several critics of the government have been arrested. One of the detained reportedly is journalist Juan Barrera who said his radio license was canceled for "being disrespectful to government officials."

To avoid trouble the government also ordered postponement of the funerals of two students killed earlier in the week in a gun battle between pro and anti-government groups in the university.

As Carter prepared to leave Panama at the end of his 23a-hour stay. White House officials expressed satisfaction with the visit, including the reception he received in the Canal Zone. Sen. Paul Sarbanes (D-Md.), reflecting a widespread sentiment among the congressional delegation that accompanied the president, predicted that the visit would have a positive impact throughout Latin America.

Before his speech at Ford Clayton, the president flew by helicopter along the length of the canal, peering down at the hips as they made their way between the Atlantic and Pacific oceans.

Later, Carter went to the Miraflores Locks where he started motors that changed the level of the water so an American container ship, the American Apollo, could pass through the locks.

Carter may have been weary by the end of this hectic visit here. A state dinner that Torrijos hosted Friday night was more than an hour late starting, with the president's official toast to torrijos not coming until early yesterday morning.

Torrijos, the military leader of Panama for 10 years, clearly hoped to use the Carter visit to prop up his sometimes shaky popular support. Nonetheless, at the end of the visit a number of opposition groups had issued statements condemning the new treaties as unfair to Panama and criticizing the Torrijos government for repressive measures.

While in Panama, Carter met with the presidents of Columbia, Costa Rica and Venezuela and the prime minister of Jamaica as well as Torrijos. Yesterday afternoon, the six leaders issued a joint statement pledging to work for a ban on nuclear weapons in Latin America and to promote human rights and economic development in the Western Hemisphere.

Mexican President Jose Lopez Portillo attended the ratification ceremonies Friday, but left before the talks. He told reporters here that he regretted that the treaties left the door open for future U.S. intervention in Panama.