In a dispatch to Washington, the United States Ambassador to Mexico, John Gavin, said it was the unanimous opinion of Mexican leaders interviewed by the embassy that the consequences of the legislation would be ''highly unfavorable for the U.S. economy and for U.S.-Mexican relations.''