A recent poll put Mr. Raisi in second place in the race for the presidency, with 27 percent of the projected vote. The same poll, by the Iranian Students Polling Agency, projected that the incumbent president, Hassan Rouhani, will get around 42 percent, depending on the turnout on Friday.
On Monday, though, the second-most-popular conservative in the race, Mohammad Bagher Ghalibaf, the mayor of Tehran, suspended his campaign and threw his support to Mr. Raisi, possibly raising what analysts say are his chances of pulling off an upset.
While Mr. Ghalibaf is nominally a conservative, he bases his appeal on his management skills, not ideology, so it is unclear how much, if at all, he might actually help Mr. Raisi.
In 1979, the impoverished and religious masses from what was then a vast rural population were the driving force behind the revolution. Iran today is far more urban and educated, but the split endures. Mr. Raisi is calculating that by pounding away at the themes of inequality and corruption he can reap enough votes from the declining provincial sector to propel him to victory.
Many of those voters, who strongly believe in the Islamic Republic’s anti-Western ideology or feel strangled by poverty, hail Mr. Raisi as a savior, ready to set Iran back on the right course.
At the same time, Mr. Raisi has refrained from raising any of the social issues his faction usually cares so much about, such as Islamic dress codes and segregation of men and women, as they might put off potential voters.
His critics see him as a hypocrite, a consummate insider who has suddenly adopted the stance of a populist outsider and corruption fighter. “Mr. Raisi misuses religion and makes empty promises,” said Hossein Ghayyoumi, a reformist cleric who supports Mr. Rouhani. “Why has he not fought corruption within the judiciary, where he has been for the past 38 years?”
He also has a dark episode in his past as a judiciary official, accused of involvement in the mass execution of political opponents in 1988 — something that Mr. Rouhani is not shy about mentioning.
Mr. Raisi and Mr. Rouhani are both Shiite Muslim clerics and staunch defenders of the idea of an Islamic Republic ruled by clerics, with some direct elections. But the similarities end there. To a surprising extent, their differences mirror those in Europe and the United States: the establishment versus populism, globalists versus nationalists.
Mr. Rouhani is the globalist, seeing the way forward in outreach to other countries and foreign investment to reinvigorate the ailing economy. A critical element in that strategy was the completion of the nuclear agreement with the United States and other world powers, which the president sold as an essential first step. It has not worked out that way, however, as existing, unilateral United States sanctions have hindered foreign investment and banking.
Sensing Mr. Rouhani’s vulnerability, Mr. Raisi as nationalist has criticized the pact, saying on Wednesday, “Where in the world does a government weaken its defensive potentials, missiles for preventing wars?”
He says the solutions for Iran’s problems must be found “inside the country” and asserts that one of the main reasons Iran is stable and secure is its military support for Shiite fighters in Iraq and Syria.
“The only attitude to solve problems is a revolutionary spirit,” Mr. Raisi said in an interview with state television. He has promised to create millions of jobs using what he likes to call “jihadi management,” and to increase monthly cash handouts for the poor.
“He will bring the economists and experts who have been neglected in past years and fix things,” said Hamidreza Taraghi, a hard-line political analyst.
Mr. Raisi’s campaign has been quick to pick up on new opportunities offered by social media, now available in Iran. He regularly posts on Instagram and has channels on Telegram, where his campaign spreads video clips of him speaking or meeting personalities.
However, liberal economists dismiss Mr. Raisi’s ideas as fanciful and dangerous. “His economic and social policies are like those from former President Mahmoud Ahmadinejad: disastrous,” said Saeed Laylaz, an economist close to President Rouhani. “What foreign company will invest in Iran if he becomes president?”
Mr. Raisi enjoys the support of many in Iran’s security forces, including the powerful Revolutionary Guard Corps and the members of the paramilitary basij forces. He also appears to have the support of Ayatollah Khamenei, who like Mr. Raisi is a staunch guardian of the country’s anti-Western ideology.
In a recent speech he criticized the government’s signing of a Unesco agreement on education and the equal rights of men and women, which he said was contrary to Iran’s cultural values. “Why have they signed this?” he asked publicly.
Ayatollah Khamenei has also criticized the liberal economic policies of the Rouhani government, stressing that Iran must be self-sufficient and embrace what he calls the “resistance economy,” which presumably is not that different from Mr. Raisi’s “jihadi management.”
Nevertheless, Ayatollah Khamenei is also a pragmatist who has signed off on important decisions — like negotiating directly with the great Satan, the United States, in brokering the nuclear agreement — that contradict some of the Islamic Republic’s longstanding political views. After the deal was completed, Iran opened up further politically by inviting European and Asian leaders long shunned by hard-liners.
Moreover, in Iran presidents typically serve two terms. Mr. Khamenei is generally not one to break with tradition, so while anything can happen in the voting, he may be comfortable with a second term for Mr. Rouhani, especially after a bruising fight that leaves the president weakened.
But Mr. Raisi is not to be lightly dismissed. Believed by adherents to be a descendant of the Prophet Muhammad, he is currently the custodian of the Shrine of Imam Reza, the wealthiest religious endowment in the Middle East.
He was born and raised in the eastern city of Mashhad, the son of a cleric, and joined the revolution at a young age. During those turbulent days, the 20-year-old was propelled into a series of sensitive positions, serving as a prosecutor in several cities and trained by Ayatollah Khamenei as a promising young bureaucrat. In 1985, he became the deputy prosecutor of Tehran.
It was in that position that Mr. Raisi was implicated in one of the bloodiest episodes in the history of the Islamic Republic. He and three others, including the current minister of justice, Mustafa Pourmohammadi, sat on a committee that sent thousands of political prisoners to their deaths.
Mr. Raisi has not commented specifically on the event, but has said that as a prosecutor he “never sent anyone to their deaths.”
He is married to the daughter of the hard-line Friday prayer leader of Mashhad, Ahmad Alamolhoda, who recently led a successful fight against pop concerts there, saying they do not befit a holy city.
In a campaign video Mr. Raisi elaborated on the controversy, saying, “I remember when there was such a hype over the concerts, I told my friends, the government should think up a solution for the concerts of poor people, the concerts of slum-dwellers, and the concerts of salaries below 1 million toman,” about $250. The government should listen to the complaints of the poor, Mr. Raisi said, before worrying about pop concerts.
As the head of the Astan Quds Razavi, the religious foundation, Mr. Raisi potentially has access to billions of dollars, a fact that Mr. Rouhani has raised repeatedly in recent attacks.
In his campaign video, however, Mr. Raisi played down the power of the institution.
“Right now I am in charge of a very small foundation,” he intoned. “Just imagine what we could achieve if it was at the national level.”