Kamin Khan, a police official, said that people "everywhere" were wounded, including police, children, MPs and officials from the department of agriculture.
Homayun Hamidzada, a spokesman for Hamid Karzai, the Afghan president, said: "The president condemned this attack in the strongest terms possible.
"This is the act of the enemies of the people of Afghanistan."
Al Jazeera's Hamish MacDonald in Kabul said that a delegation of Afghanistan's parliamentary finance committee was visiting the factory when the bomber struck.
The bomber was on foot and blew himself up as schoolchildren lined up to welcome the parliamentary delegation on a visit to the sugar factory.
|Mostafa Kazemi, head of the parliamentary|
delegation, was among the dead [AFP]
Large crowds had also turned out to greet the deputies, on an economic fact-finding mission.
The delegation of parliamentary deputies was led by Mostafa Kazemi, the opposition spokesman, a provincial spokesman said.
It included about 18 MPs, Daud Sultanzai, a parliamentarian in Kabul, said.
Al Jazeera's correspondent in Kabul said Kazemi was taking the delegation on a tour of Baghlan, and was the apparent target of the bombing.
Shukria Barakzai, a parliamentarian who was wounded in the attack, told Al Jazeera: "This is not Islamic tradition. It is really anti-Islamic. Our advice to the government is to be strong, for the people of Afghanistan.
"Please try to be a responsible nation. Do not allow terrorists to come in, and do not allow yourself to be a victim of their extremist ideology."
Northern Afghanistan has been relatively peaceful and prosperous compared to the south and east.
But the attack in a small market town in a melon-growing region with streets lined with citrus trees, had all the hallmarks of a Taliban operation.
There was no immediate claim of responsibility but there have been about 120 suicide attacks in Afghanistan this year, most of them blamed on the Taliban.
However, a Taliban official told Al Jazeera that the group was not claiming responsibility for the blast.
There are tensions between the mainly ethnic Tajik leadership in the region and remnants of the Hezb-i-Islami group, whose leader Gulbuddin Hekmatyar, an ethnic Pashtun, is sympathetic to Osama bin Laden and al-Qaeda but denies any organisational links.