Presidential hopeful and two-time candidate Andrés Manuel López Obrador greets supporters as he arrives at a campaign rally for Delfina Gómez, who is running for Mexico state governor. (Rebecca Blackwell/AP)

Whoever wins the race for governor here in Mexico’s most populous state Sunday, there is one politician who has already come out on top, and he’s not even on the ballot.

Andrés Manuel López Obrador, the left-wing populist and former mayor of Mexico City, isn’t a candidate in Sunday’s race, at least not exactly. But he’s running for president next year and campaigning hard alongside his ­handpicked candidate in the ­gubernatorial contest, Delfina Gómez. Her win Sunday — and by extension, his — would send shock waves through Mexico’s political and business elite. 

Gómez, a former schoolteacher and relative newcomer, has been polling roughly even with Alfredo del Mazo, the scion of a powerful political dynasty and the ­standard-bearer of the Institutional Revolutionary Party (PRI), which has ruled the state of ­Mexico for 86 years. Del Mazo also happens to be the cousin of Mexican President Enrique Peña Nieto.

As a proxy contest and a warm-up for next year’s presidential race, Sunday’s results will be closely watched in Mexico and beyond. A Gómez victory would make ­López Obrador the clear favorite for 2018, and he has embraced a more nationalistic, confrontational approach to coping with President Trump.

Even if Gómez loses, analysts say, her insurgent campaign has given López Obrador a trampoline for his presidential run, solidifying his status as the leading anti-establishment candidate in a country that’s fed up with conventional politics. López Obrador formed his own party, the National Regeneration Movement, or Morena, three years ago.

“This is an election that reflects the cost of corruption scandals and the growing strength of López Obrador. It’s the man against the machine,” said political analyst Denise Dresser. “And even if [Gómez] were to lose, he can say victory was snatched away by vote-buying and emerge as a victim.”

Mexico’s other major parties have yet to pick their presidential candidates for next year, when Peña Nieto’s six-year term will expire. In Mexico, presidents cannot run for reelection.

Predicting Sunday’s outcome is difficult. There are two other ­contenders in the race, Josefina Vázquez Mota of the National Action Party (PAN) and Juan Zepeda of the leftist Democratic Revolution Party (PRD). In polls, they each draw about 15 percent of the vote, so their supporters could swing the outcome if they change their votes.

Alarmed by the possibility of an embarrassing loss on its home turf, Peña Nieto’s PRI has poured money into a contest muddied by allegations of dirty tricks. PRI presidents ran Mexico from 1931 to 2000, and the party managed to hold on to power in the state of Mexico long after that, thanks to vast networks of patronage and a support base that reliably delivered at election time.

With 16 million people, the state hugs Mexico City like a horseshoe, spanning everything from posh suburbs to huge slums whose residents endure long, miserable commutes to jobs in the capital. It plays an outsize role in Mexican politics, and its problems are those of the nation as a whole: soaring crime rates, stagnant growth, poor public services and monstrous levels of corruption.

The state also has been a path to Mexico’s highest office, most recently for Peña Nieto, who had been governor before defeating López Obrador in the 2012 presidential race.

But Peña Nieto has fared poorly as president, weakened by scandals, disappointing growth and the perception that Mexico’s ruling class is irredeemably venal and out of touch.

Gómez and López Obrador have barnstormed the state with an anti-corruption message urging voters to depose what they call the PRI “monarchy,” embodied by figures like Del Mazo and Peña Nieto. Del Mazo’s father and grandfather both served as the state’s governor.

“It’s time to give a chance to someone else who isn’t from the PRI,” said Ricardo Acosta, 37, a security guard watching one of Gómez’s rallies this week. He wasn’t especially impressed with her, he said, but he liked López Obrador. “He reminds me of Benito Juárez,” the Mexican national hero, Acosta said. “He’ll fight for those of us who are on the bottom.”

Although Trump hasn’t been a factor in the governor’s race, Acosta said he thought López Obrador and his party would be more likely to “stand up for Mexico.” Trump campaigned on a pledge to build a wall on the U.S.-Mexico border, demanding that Mexico pay for its construction. He angered Mexicans further by referring to ­undocumented Mexican immigrants who cross into the United States as criminals, drug traffickers and rapists.

Other than a few Che Guevara T-shirts in the crowd, it was less a rally with a left-wing message than an anti-PRI one.

Del Mazo’s signature proposal is something he calls a “Pink Salary” that would provide cash payments to women who qualify as “housewives.” It’s not clear how the payments would work, or how much cash they would provide, but it reinforces the PRI’s reputation as a party of transactional politics.

“This country is a sucker for that type of thing,” said Victor Alpizar, 52, who spent seven years working in Atlanta and Houston restaurants and now owns a copy shop. The streets are dirty and unsafe, he said, and government taxes and fees are choking small businesses like his, he said. “But there are more and more people like me who are sick of it. They’re not willing to sell their vote for a handout.” 

One customer at his shop, ­Gabriela Hernández, said PRI members had come to her ­mother-in-law’s home the week before and offered her discounts at a local business, almost like a club membership. In exchange, she said, they wanted her voter ID card — to assure that she wouldn’t be able to vote Sunday.

“They want to stop the other side from voting,” said Jorge Castañeda, a fierce PRI critic who served as foreign minister under former president Vicente Fox of PAN. “This will be one of the most fraudulent elections in Mexico [in decades], but, thanks to that, Del Mazo will probably win.”

The accusations cut both ways. Mexico’s headlines this week were splashed with the sensational claims of a former Morena lawmaker caught on video allegedly receiving illegal campaign cash for López Obrador. López Obrador insisted that the only money he receives is a $3,000 monthly salary as the director of the Morena party.

Still, the lawmaker’s accusations may undercut the anti-corruption message of the Gómez campaign, and it will face an opponent with an unrivaled, battle-tested electoral operation.

A large rally this week for Del Mazo in the industrial Mexico City suburb of Naucalpan had the feel of a rock concert and was at least as loud as one. The candidate, a tall, fair-skinned man with perfect teeth who bears little physical resemblance to the vast majority of the state’s voters, ascended to the stage to deafening cheers and pounding drums.

Del Mazo spoke with the same well-rehearsed, familiar cadence of Peña Nieto. “I will be the governor who fights for women!” he said.

“I’ve been a PRI supporter all my life,” said Lucia Villa, 55, wearing a hot-pink Del Mazo shirt and hat. Like many Mexicans, she seemed resigned to the corruption in Mexican politics and was willing to tolerate it as long as it brought modest benefits like a Pink Salary.

“The PRI has had good moments and bad, but the good outweigh the bad,” Villa said. “They’re the ones who can get things done.”

Valeria Moy, an economist at Mexico’s Autonomous Institute of Technology, said the governor’s race has brought out the country’s worst political habits: empty slogans, unrealistic populist promises and a campaign devoid of substance — all in a state whose fortunes are critical to Mexico’s success.

“This is why we’re not making progress as a nation,” Moy said. “It’s been a sad campaign.”