Afghanistan’s presidential race is in full swing, with several former officials lining up to challenge President Ashraf Ghani in a vote to be held in July, amid a raging war and fears that yet another fraud-marred election could further destabilize the country.

On Friday, Mohammad Hanif Atmar, a powerful former national security adviser who parted ways with the government in August, became the most serious challenger to formally join the race so far. He vowed to “save the country” from what he has described as Mr. Ghani’s mismanagement.

He joins a list of former officials who have either formally joined the race or declared that they will do so. They include Rahmatullah Nabil, a onetime intelligence chief who has selected an army general and a female former cabinet minister as his running mates (Afghanistan has two vice presidents); Zalmai Rassoul, a 75-year-old former foreign minister, who came a distant third in the disputed 2014 race that brought Mr. Ghani to power; and Shaida Abdali, a former diplomat seen as close to former President Hamid Karzai.

Mr. Ghani, who has declared that he will seek a second term, is scheduled to begin his re-election bid on Sunday. A senior official close to him said Mr. Ghani had dismissed his controversial first vice president, Gen. Abdul Rashid Dostum, from the ticket, with Amrullah Saleh, a former intelligence chief that he recently tapped to lead the country’s police force, replacing him.