Three of the nation's former top-ranking military leaders gave their views on the Panama Canal treaties yesterday - two endorsing the proposed agreements and the third calling for their rejection.

These conflicting opinions came from Gen. Maxwell D. Taylor and Adm. Thomas H. Moorer, former chairman of the Joint Chiefs of Staff, and Adm. Elmo R. Zumwalt Jr., retired chief of naval operations.

In testimony before the Senate Foreign Relations Committee, the three agreed that the canal will continue to be of vital importance to the defense of the United States. But they differed sharply about whether U.S. military needs willl be aided or injured by transferring eventual control over the canal to Panama.

Moorer, an outspoken opponent of the treaties, argued that continued U.S. ownership is "synonymous" with effective control of the canal and the ability to move warships quickly between the Atlantic and Pacific oceans.

Charging that the Panamanian government headed by Gen. Omar Torrijos is openly leftist in its sympathies, Moorer warned: "Do not be surprised, if the treaty is ratified in its present form, to see a Soviet and/or a Cuban presence quickly established in the country of Panama.

However, Taylor and Zumwalt took the opposite tack. They argued that continued U.S. control would perpetuate a "colonialist relationship" that would aggravate leftist, anti-American sentiment in Latin America and make the canal increasingly vulnerable to sabotage and terrorist attacks.

"There will be a lot of cheers in Moscow and Havana," Zumwalt said in reference to the possibility of the Senate refusisiug to give the treaties the two-thirds margin of 67 votes required for their approval.

To which Taylor added: "Turbulence there is always good news to Moscow - so are American blunders. Let us hope we do not give the Kremlin chiefs the occasion to rejoice which our rejection of these treaties would undoubtedly afford."

Basically, the position taken by Taylor and Zumwalt was that, while there are potential risks involved in either course, the greatest dangers to future canal operation would be terrorist in nature. Thesse dangers, they asserted, can be combatted best if the government of Panama feels it has a stake in keeping the canal open.

As Zumwalt put it, "The cooperation of a favorably disposed government in Panama is needed to provide a reasonable prospect of defending the canal from an internal threat."

One area where the three took differing positions involved the apparent contradictions that have arisen in official U.S. and Panamanian interpretations of key defense provisions in the treaties.

The Carter administratition contends that, after Panama takes control in the year 2000, the treaties give the United States permanent future rights to intervene militarily against threats to the canal and to obtain priority passage for U.S. ships in time of war.

However, these U.S. contentions have been disputed by some officials of the Torrijos government, which is attempting to counter charges by domestic opponents that Panama made too many concessions. In the resulting confusion, several senators have warned that the treaties have little chance of approval unless these contradictions are resolved.

Moorer pointed to the differing interpretations as proof that the United States cannot rely on the treaty language to safeguard its rights. He said: "I submit that ownership and control, on one hand and priority passage and defense, on the other, are synonymous."

Zumwalt said his support of the treaties wasbeing made on condition that these disputed points are clarified satisfactorily. But, he added, he recognized that it would be politically difficult for the Panamanian government to recognize publicly a U.S. right of intervention.

It was obvious, Zumwalt said, that the treaty negotiators had deliberately masked these points in "fuzzy language" as a bow toward Panamanian sensibilities. He suggested that the Senate might be able to overcome the problem by attaching to the treaties "a resolution" spelling out the U.S. understanding of what the treaties mean regarding the disputed points.

However, he did not specify whether such Senate action should take the form of a nonbinding resolution or an amendment or legal reservation that would become part of the treaties. Either of the latter options would require the approval of Panama.

Taylor went even further, arguing that the Senate should not tamper with the treaty language despite its admitted ambiguities. He noted that the word "intervention" has particularly emotional connotations throughout Latin America because of the long history of U.S. interference in that region.

"I don't see how we could try to spell that out without giving great offense to Panama and to the rest of Latin America," he said. "'Intervention' used in any form is regarded as a code word down there; to use it would kill the treaties."