The United States ceremoniously ended 75 years of control over a 10-mile wide swath through this country yeaterday as President Carter and Panamanian military leader Gen. Omar Torrijos formally exchanged the documents ratifying the Panama canal treaties.

With the leaders of five other Latin American countries looking on, the president brought 3,000 invited guests at the ceremony to their feet cheering when he pledged that the United States under the new treaties will never intervene in Panama's affairs.

Later, addressing a crowd estimated by local officials at more than 200,000 people at an outdoor plaza, Carter declared that the Western Hemisphere stands "on the threshold of a new era of inter-American understanding and cooperation."

He siad the treaties marked a renewed commitment to "the principles of peace, nonintervention, mutual respect and cooperation" between the Unitd States and its Latin American neighbors.

No serious incidents marred the beginning of the president's scheduled 23-hour visit here. Tension over the Carter visit mounted sharply after two university students were killed Thursday night in an outbreak of shooting between pro and anti-treaty factions.

The military government here cracked down after the incident, closing the university campus and suspending classes at a militant high school that had also been the site of demonstrations against the new treaties. Some Panamanians believed the treaties are overly favorable to the United States.

A large crowd turned out all along Carter's motorcade route, becoming an enormous mass near the plaza where he spoke. This was in part the result of a concerted government effort to provide a friendly welcome to the visiting American president.

The Torrijos government has been accused of repressive measures and in his speech at the plaza. Carter made a pointed appeal for an expansion of humans rights throughout Latin America.

"Let us advance the cause of human dignity and build a hemisphere in which citizens of every country are free from torture and arbitrary arrest - free to speak and write as they please - free to participate in the determination of their destiny," the president said.

To achieve theser goals, he added, "We will need not new slogans but a new spirit," that "recognizes and respects the rights of others and seeks to help all people to fulfill their legitimate aspirations with confidence and dignity."

The treaty ceremony at the Panama City coliseum was a symbolic end to a decade-lond struggle by Panama to gain control of the canal and the surrounding Canal Zone, which have been under U.S. jurisdiction since the original treaty was signed in 1903.

Under terms of the new treaties, the agreements take effect next April 1, with the actual transfer of control over the canal beginning six months later on Oct. 1, 1979.

The transfer of control over the canal will continue gradually until the year 2000, when Panama will assume full responsibility for the canal's operations. A second "neutrality treaty" guarantees the canal's neutrality and gives the United States an unlimited right to defend it.

As Carter began to sign the first of the documents involved, the crowd in the coliseum stood and applauded. When the ceremony ended, Torrijos reached out to embrace Carter and the crowd cheered.

The ceremony was witnessed by the presidents of Venezuela, Costa Rica, Mexico and Columbia and the prime ministers of Jamaica all of whom supported the new treaties. Carter met last night with all of the visiting leaders and is scheduled to have a second session with them today.

The president arrived here in the tropical midafternoon heat. He was accompanied by a large U.S. delegation that include four members of the House and 12 senators, headed by Foreign Relations Committee chairman John Sparkman (D-Ala.), and Sens. Frank Church (D-Idaho), and Paul Sarbanes (D-Md.), the floor managers of the treaties during the Senate debate.

Hundreds of school children dressed in gold and brown uniforms turned out to greet the president and his wife, Roslynn. As the Carters walked along a red carpet, young girls dressed in red blouses and blue skirts threw flowers in their path. Speaking in Spanish, Carter told the crowd at the airport:

"Transfering control fo the Panama Canal continues and strengthen the bond that was forged between our nations in its building. The nations of our hemisphere are embarking on a new, more equal relationship."

In the documents exchanged by Torrijos and Carter, the Panamanian government explicitly eccepted all of the amendments, reservations and understandings attached to the treaties by the Senate during its 38-day debate over the agreements.

The most controversial of these was the so-called DeConcini reservation, named after its sponsor Sen. Dennis DeConcini (D-Ariz.). The reservation to the neutrality treaty gives both the United States and Panama a unilateral right after the year 2000 to take any action, including the use of military force, to keep the canal free from outside interference.

Critics in Panama charged that this gave the United States a right to interfere in Panama's internal affairs. To soften its impact, the Senate leadership won approval of another reservation to the canal treaty stating that any action taken by the United States to protect the canal "shall not have as its purpose or be interpreted as a right of intervention in the internal affairs of the Republic of Panama."

Panama's sensitivity on this point was demonstrated in the two documents Torrijos presented to Carter. Each contained a declaration - not found in the otherwise identical U.S. document - in which the Panamanian government rejects "any attempt by any country to intervene in its internal or external affairs."

The neutrality treaty will remain in force permanently. It commits Panama to maintain the neutrality and accessibility of the canal and gives U.S. ships the right of "expeditious" passage in times of emergency.

The Senate approved the neutrality treaty March 16 and the canal treaty April 18, both by a vote of 68-32 - one vote more than the two-thirds majority of 67 votes required by the Constitution for approval of treaties.

These votes marked an end to the long and sometimes violent era of American domination of the canal and a political high point in the brief history of the Carter administration.

The president placed the full weight of his personal prestige and an extensive effort by the White House and key administration officials behind the effort to win approval of the treaties. The Senate votes came at a time when Carter's popularity was slipping, giving the administration at least a temporary boost.

Today, Carter is scheduled to inspect the canal and visit the Canal Zone where he is expected to receive a correct if somewhat chilly reception. Many of the 15,000 Americans civilians who live and work in the Zone are bitter over approval of the treaties and uncertain of their own futures in the new era the treaties will mean for the canal.