The Caribbean Sea, increasingly threatened by pollutants such as untreated sewage and crude oil, will be protected under a treaty pledging the United States and other area nations to a cooperative conservation effort, according to officials attending a meeting of signatory nations that ended today.

"The idea is to stop the Caribbean from becoming another Mediterranean," said Melville Gajraj of the United Nations Environmental Program, which organized a meeting in Mexico this week of 13 of the treaty's 28 signatory countries.

The treaty, known formally as the Convention for Protection and Development of the Marine Environment of the Wider Caribbean Region, is modeled after an earlier U.N.-sponsored accord signed by countries bordering the ecologically deteriorated Mediterranean.

The conference, held in the Caribbean resort of Cancun, was "a rare example of cooperation and cordiality" among countries that are often at diplomatic odds, a U.N. official commented.

Among the 13 nations represented at the three-day meeting were Nicaragua and Cuba, credited with engineering a rules change that will permit the United States to join the treaty's nine-nation monitoring committee. "The Americans and Cuban were getting on so well that we thought they were about to hug one another," remarked one conference participant, who asked not to be named.

Delegates from the four countries seeking a negotiated peace in Central America -- the Contadora group of Venezuela, Panama, Colombia and host Mexico -- also attended. Other participants were France, the Netherlands, Barbados, Jamaica, St. Lucia, Suriname and the United States. The ideologically varied assemblage was "proof of how environmental concerns have overcome political differences," the U.N. agency declared in a published statement.

Originally adopted in Cartagena, Colombia, in 1983, the Caribbean treaty will be ratified before the end of July by the required minimum of nine signatory nations, delegates to the conference reported. The legislatures of four countries -- the United States, the Netherlands, Mexico and St. Lucia -- had approved the treaty before this week's meeting. Representatives of Barbados, Panama, Jamaica, Venezuela, France and Cuba told the conference that they expected parliamentary approval of the convention within the next 90 days, according to U.N. sources.

In its present form, the treaty does not regulate such critical land-based pollution sources as soil and sewage runoff.

"You have to start with an umbrella treaty that is fairly innocuous," a strategy followed earlier by U.N. environmentalists during the Mediterranean treaty negotiations, said a U.N. official who requested anonymity.

Averting one feared political clash, Mexico and the United States agreed today on a compromise resolution condemning the "illegal and irresponsible disposal of hazardous wastes and toxic substances in the wider Caribbean." Mexico originally had favored a resolution attacking the announced plans of a U.S. firm to incinerate toxic substances in specially equipped ships in the Gulf of Mexico, plans that U.S. sources say the Environmental Protection Agency would refuse to authorize in any case.

U.S. Coast Guard Capt. Charles Corbett, one of two U.S. delegates, noted that the Caribbean treaty creates a needed "multilateral" framework for cooperation between Cuba and the United States in combating oil spills. There are no bilateral arrangements permitting U.S.-Cuban coordination should a spill occur in their adjoining waters, he pointed out today in a telephone interview.

Tests to determine the biodegradability and toxicity of chemical dispersants are among eight high-priority research projects that will be subsidized by the recently created Caribbean Trust Fund, the conference decided. Supported by voluntary donations, the trust fund is now disbursing $800,000 to cover the costs of some of the 33 research projects approved by area nations and in need of subsidy.

Other projects to be funded include aid for sea turtle preserves, the ecological monitoring of waters around the Windward Islands and the treatment of what is perhaps the most peculiarly Caribbean pollution source, the effluent from rum distilleries. French liquor companies, the French government, and the European Community already have pledged $1 million for research into the chemical detoxification of the waste rum "vinegar."