Rep. Michael D. Barnes (D-Md.), fresh from his first foreign trip as a member of Congress, took to the floor of the House yesterday to warn his colleagues that the overriding danger to the nation's energy supply may not be gasoline or oil or coal, but tomatoes.

Specifically, Mexican tomatoes.

Barnes, who visited Mexico during last week's congressional recess, said that while he was anxious to discuss ways of getting more Mexican oil and gas for U.S. consumers, "everyone I met wanted to talk about tomatoes."

The Montgomery County freshman said he made the "purely educational trip" to increase his understanding of America's oil-rich southern neighbor. He admitted that he had barely known about the "tomato war" between growers in Florida and Mexico.

But now he is enough of an expert to warn President Carter, in a letter yesterday that followed his floor speech, that "no single issue could more quickly and tragically sour U.S. Mexican relations than a decision by the Treasury Department's general counsel to apply antidumping statues to Mexican winter tomatoes."

Department's general counsel to apply antidumping statues to Mexican winter tomatoes."

Such an action is being sought by Florida growers, as the latest round in a 20-year battle for the half-billion-dollar American winter tomato market.

The Treasury Department is scheduled to make a preliminary finding by July 19 on the year-old charge that Mexican farmers have been selling their vine-ripened tomatoes at below cost to American supermarkets - dumping, in inergovernmental parlance.

If the ruling goes against Mexico, Barnes said he was told time-and-time-again, about 200,000 Mexican farmers will join the already 40 percent unemployed in that nation. Not only will that event force up the price of tomatoes and other winter vegetables - which then would be grown in Florida - but the out-of-work Mexican laborers are "likely to join the flood" of illegal aliens who come to this country seeking work, Barnes explained in an interview in his Capitol Hill office.

Even worse, Barnes went on, the Mexican government is likely to retaliate for the loss of a $200-to- $300 million tomato market by holding back its oil and gas.

Implementation of the 58-year-old protectionist statute could force American buyers of Mexican tomatoes to pay a duty equal to the difference between the sale price and the production cost. Barnes said that rather than pay the duty, wholesalers would buy Florida vegetables exclusively.

Barnes argued that the antidumping law should not apply to perishables, which "you sell for the best price you can get. You can't put a tomato in a warehouse and save it for sale next year."

Discovery of the tomato war was the bad news of Barnes fact-finding mission, on which he was accompanied by Rep. David Bowen (D-Miss.) and Victor Johnson, a staff member of the subcommittee on international economic policy and trade.

The good news, unless it is offset by the tomato trouble, is that Mexico may have more oil to sell to the United States next year than previously Barnes said.

Mexico's oil exports are tied to its ability to use the profits for development of industry there, he said, and preliminary indications are that home-grown industry is developing faster than expected. America buys about 80 percent of the oil exported by Mexico, which this year amounts to about 400,000 barrels a day. Next year, that could go beyond one million barrels daily, Barnes was told.