On the campaign trail, Turkish President Tayyip Erdogan has promised large infrastructure projects; here, people watch a campaign rally in Mardin, southeastern Turkey, on Wednesday. Photo: GORAN TOMASEVIC/Reuters

ISTANBUL—Turkey’s President Recep Tayyip Erdogan is bidding to extend his 15-year rule on Sunday in elections that rivals deem unfair—a growing pattern in countries from Russia to Hungary to Egypt, where leaders are using ballots as a waypoint to cement their authoritarian grip on power.

But with economic woes weighing heavily on Turkish voters, the prospect of Mr. Erdogan entering a five-year term with a rubber-stamp parliament isn’t guaranteed, threatening a period of uncertainty in this strategic linchpin between the West and the Middle East.

Since a 2016 military coup attempt that nearly swept him away, Mr. Erdogan has jailed former allies he accuses of plotting the attack and run the country under “extraordinary rule” that allows for exceptional police measures and governance by decree. He has cracked down on political opponents and assembled a coterie of loyal oligarchs; he has repressed independent press and purged the military.

Mr. Erdogan addresses an election rally in eastern Turkey on Thursday ahead of the parliamentary and presidential elections. Photo: Associated Press

This one-man drive has given Mr. Erdogan unprecedented control over all state institutions, including the electoral authority, ahead of Sunday’s presidential and parliamentary ballots.

And yet, unlike in Russia where President Vladimir Putin was re-elected with 77% of the votes in March, Turkish pollsters predict a divided result.

A string of surveys published before a 10-day blackout period showed Mr. Erdogan winning the presidency by a razor-thin margin in the first round or with a wider lead in a July 8 runoff between the top two finishers.

Those surveys also showed him possibly failing to secure a majority in the single-round parliamentary vote because, pollsters say, double-digit inflation and a dwindling lira have eroded confidence in his ruling party.

Such results could plunge Turkey into a period of uncertainty as the country is helping Europe control a migrant influx and has repositioned itself as a power broker in the Syrian war.

Political upheaval in Turkey could also complicate efforts to repair a bruised relationship between Ankara and Washington, with the U.S. angry over Turkey’s decision to purchase an antimissile shield from Russia and Turkish authorities stewing over the lack of action on their demand that the U.S. deport a cleric they say was behind the failed coup. The cleric, Fethullah Gulen, denies the accusation.

Raising the stakes, Turkey will be introducing a new presidential regime. A re-elected Mr. Erdogan would gain vastly expanded executive powers to shape legislation and the judiciary thanks to constitutional changes voters narrowly approved last year. But opposition forces in control of parliament could use the assembly to challenge his authority.

“This is going to be the most difficult election in our history,” said Suat Kiniklioglu, who left Mr. Erdogan’s Justice & Development Party, or AKP, in 2012.

Since calling snap election two months ago, the 64-year-old Mr. Erdogan has been flooding the airwaves, leaving little airtime to rival contenders. He has unveiled grandiose construction plans, such as digging a 25-mile canal parallel to the Bosporus, announced a $6 billion package comprising a tax amnesty and special allowances for pensioners, and held a seemingly impromptu meal with university students.

“Give me your hands and let the most powerful reign begin,” he says in a campaign clip featuring a phoenix flying over river dams, bridges and other large public works built since he took office in 2003.

The president’s re-election promises have appeared out of sync with the everyday preoccupations of voters, according to Murat Sari, head of Turkish polling agency Konsensus.

A billboard advertises future apartments alongside a proposed Istanbul canal that is one of Mr. Erdogan’s ambitious construction projects. Photo: yasin akgul/Agence France-Presse/Getty Images

Since the start of the year, the Turkish lira has lost a quarter of its value against the dollar, dragged down by accelerating inflation and declarations by Mr. Erdogan that he intended to play a bigger role in directing monetary policy. A weakening lira dents the spending power of Turkish households because the country imports most of its fossil-fuels needs.

“Two years ago, voters cited terrorism as the most important problem facing Turkey,” Mr. Sari said. “Now, it is inflation, followed by unemployment and income inequalities.”

Unlike Mr. Putin, the “Tall Man,” as his supporters affectionately call Mr. Erdogan, is faced with a deeply divided nation and challenged by an unusually united opposition.

Turkish President Recep Tayyip Erdogan’s authoritarianism and pursuit of a nationalist agenda has put his country at odds with its U.S. and NATO allies. Meanwhile, he’s found a friend in Vladimir Putin. Photo: Getty Images

In a surprise development this spring, the newly created nationalist Good Party struck an alliance with two political forces that had traditionally been far apart—the secular Republican People’s Party and the pro-Islam Felicity Party. The main pro-Kurdish movement, the Peoples’ Democratic Party, which has nearly 9% of the seats in the current assembly, hasn’t ruled out working with the alliance.

Worried about electoral fraud, especially since amended rules allow for unstamped ballots to be considered as valid, members of the alliance have agreed to deploy observers to monitor balloting and compile their own results.

“Despite his dominance, Mr. Erdogan isn’t able to subdue half of the population,” said Mr. Kiniklioglu, the former AKP lawmaker, who is now an analyst at Sweden’s Institute for Security & Development Policy. “And this time the other half is organized.”

Muharrem Ince of the Republican People’s Party, the presidential candidate who is best positioned to face Mr. Erdogan in the event of a runoff, has concentrated his campaign on governance, promising to end arbitrary arrests and lift the state of emergency in place since the 2016 attempted coup.

“Turkey cannot live with this stress anymore,” Mr. Ince said in an interview.

During the campaign, Mr. Erdogan has portrayed himself as an accessible and attentive leader focused on solving problems.

In a recent clip posted on his official Twitter account, the president was filmed shortly after 2 a.m., walking down spiral stairs at his sprawling presidential palace in Ankara, and sharing a predawn Ramadan meal in a marble hall with students.

Addressing a complaint that university dorms have been charging fees during summer-holiday breaks, Mr. Erdogan said: “I have given orders now. You will no longer pay a fee during the summer term.”

Since the 2016 coup, however, authorities have arrested thousands of people, including many teachers, on accusation of colluding with coup plotters or alleged terrorist groups. Some voters say they no longer dare dissenting with Mr. Erdogan.

Last year, soon after posting an online video criticizing the president’s constitutional reform, Istanbul University law student Ali Gul was summoned to police. Detained for two months, he was given suspended prison sentences for tweets insulting the Turkish nation and Turkey’s president. He says the tweets weren’t his.

With the elections approaching, Mr. Gul said he thought about shooting another critical video but gave up on concerns he would be arrested again.

“My mom is too old,” said the 22-year-old, who has since passed his law degree. “I don’t think she could withstand it.”

In a bid to defend his reputation as a good steward of the economy, Mr. Erdogan has hailed progress on construction of the world’s largest airport hub near Istanbul, and heralded other big construction plans.

Muharrem Ince, the presidential candidate of Turkey’s main opposition party, addresses a rally in Izmir on Thursday. Photo: Ziya Koseoglu/Associated Press

At a recent rally in a large sports hall, maps and digital mock-ups projected on large screens behind Mr. Erdogan showed how the proposed canal in Istanbul would connect the Black and Marmara seas, and house a population of seven million along its banks.

“Canal Istanbul is a giant project,” he said. “It will transform the economy.”

Rivals have criticized the pharaoh project as environmental and urban-planning heresy, and pointed to the risks of corruption.

Mr. Erdogan has responded to critics saying his challengers weren’t suited to lead the country.

“My rivals, what are they capable of,” he said. “Will they build an airport? Will they dig a canal?”

Write to David Gauthier-Villars at David.Gauthier-Villars@wsj.com