The Taliban claimed responsibility for Tuesday's explosion in Charikar, the capital of Parwan province, north of Kabul.
Abdul Qasim Sangin, head of Parwan hospital, told Al Jazeera the blast killed 24 people and wounded 32 others. The casualties included children and there are fears the number of victims could rise.
Ghani was present at the time of the explosion but is safe and unharmed, his campaign spokesman, Hamed Aziz said.
Wahida Shahkar, spokeswoman for the provincial governor in Parwan, said the explosion happened at the entrance of the venue hosting the rally.
In a separate incident on Tuesday, another explosion went off in the capital, Kabul, near the Green Zone, where the defense ministry, US embassy and NATO headquarters are located. There was no immediate claim of responsibility.
Across Afghanistan, attacks have continued as the country prepares for a presidential election later this month.
MNA/PR