Mexico’s could-be president is a lot like Trump. That doesn’t mean they’d get along.

MEXICO’S LEADING presidential candidate says he represents “good and honest people” against a “mafia of the powerful.” He says, “Only I can fix corruption.” He disparages the country’s democratic institutions, saying “we live in a fake republic” and alleging, without evidence, a plot to rig the election. He promises to undo the landmark achievements of his predecessor and build up Mexican industries at the expense of trade. Andrés Manuel López Obrador, in short, bears more than a passing political resemblance to President Trump — which doesn’t mean the two are likely to get along.

If Mr. López Obrador wins the July 1 vote, bilateral relations already poisoned by Mr. Trump are likely to become still more toxic. Like his two main opponents in the presidential race, the populist front- ­runner has condemned the U.S. president — once calling his rhetoric racist and “neo-fascist” — and vowed to reject his demand that Mexico pay for a border wall. Mr. López Obrador says he favors a renegotiated North American Free Trade Agreement with higher wages for Mexican workers, but many of his policies aim at curtailing trade with the United States, particularly in energy and agricultural products. He says he would reassess one landmark reform, the opening of Mexico’s oil industry to foreign investment, and cancel another, an education revamp that broke the power of corrupt teachers’ unions.

If Mexican voters appear likely to favor this reactionary agenda — and Mr. López Obrador leads in polls by double digits — it is because they are fed up with the failures of recent centrist presidents, including the outgoing Enrique Peña Nieto. Mr. Peña Nieto promised to cut the murder rate in half; instead, it is now 25 percent higher than it was in 2011. Corruption has afflicted his administration, and economic growth has been sluggish.

Mr. Peña Nieto tried to reach out to Mr. Trump, hosting him in Mexico before the U.S. election despite fierce domestic criticism. Mr. Trump has repaid him by doubling down on racially tinged rhetoric about Mexican migrants, sending the National Guard to the border and demanding unreasonable changes in NAFTA, including a sunset clause. Mr. Peña Nieto has responded by canceling several bilateral meetings on military and anti-drug cooperation. With NAFTA negotiations stalled and Mr. Trump apparently set on making malice toward Mexico a campaign theme for the U.S. midterm elections, relations appear likely to worsen further before the next Mexican president takes office on Dec. 1.

For now, many Mexicans are less worried about bad relations with the United States than the possibility that Mr. López Obrador could lead the country back to the failed statist policies of the 1970s, or worse, the catastrophic “21st-century socialism” of Venezuela. Some of his aides are said to be close to the Venezuelan and Cuban governments, but as the election has approached, Mr. López Obrador has tacked toward the center. Supporters point to his relatively pragmatic tenure as Mexico City mayor in the early 2000s.

If Mexicans choose Mr. López Obrador, they will be, like the voters who backed Mr. Trump, blowing up the status quo without a reliable sense of what will replace it. The result is likely to be more trouble on both sides of the border.