The suicide bomber detonated an explosives belt after he was stopped from entering the mosque of the minority sect, said the witnesses.
"The bomber targeted the worship place of the Ahmedis at Muslimabad on Canal Road. We have found the head of the bomber," Mardan commissioner Akbar Khan told a news agency.
The mosque is located in a posh area of Mardan city with a sizable Ahmedi population.
The suicide attack came after militants targeted a police van with a roadside bomb on the outskirts of Peshawar in northwest Pakistan, killing a constable and injuring three others.