Al Jazeera’s James Bays, reporting from Kabul, said: "Rabbani was on his way to his home province of Badakshan and travelling through Kunduz when there was an attack.
"We understand there was a gun battle that went on for some considerable time.
"Al Jazeera spoke to the Taliban and they say that its their intention to turn Kunduz into another Helmand for foreigners."
Rabbani is a one of the main supporters of Abdullah Abdullah, the leading rival to incumbent Hamid Karzai, in the August 20 poll.
In another part of Kunduz, Taliban fighters battled police for a second straight night.
Abdul Razaaq Yaqubi, the provincial police chief, said three policemen and eight Taliban fighters were killed when police battled the Taliban until dawn in Kunduz's northern Dasht-e-Archi district.
A series of roadside bombs killed at least 14 civilians in the south, officials said.
The bombings happened in a Taliban stronghold where thousands of Western troops have been battling to subdue multiple areas ahead of the elections.
In the deadliest blast, a roadside bomb struck a minivan in Helmand province and killed a family of 11, said General Ghulam Wahdat, the police commander for the southern zone.
The dead were five sons, four daughters and both parents, he said, blaming the blast on the Taliban.
"Only one little girl around six-years-old survived," added the provincial government spokesman, Daud Ahmadi.
A roadside bomb in neighbouring Kandahar province killed three children as they were playing on Wednesday, police said.
"All the three children are boys between six and 11 years of age," said provincial police chief Mohammad Shah Khan.
The US military announced that one of its troops was killed by a roadside bomb in the south on Wednesday.
Threats and fears
The violence threatens to undermine the elections, with authorities saying that voting was unlikely in nine of 365 districts, most of them in the south, because insecurity had prevented them from working there.
|Abdullah has surprised Western diplomats by rallying in Taliban stronghold Kandahar
Thousands of troops are operating in several districts in a bid to make it safe for people to vote, but authorities are worried that Afghans will not dare to go to polls, undermining the credibility of the ballot.
The Taliban have said they would not directly attack the elections but have called on Afghans to boycott the polls and instead join their "jihad" for Afghanistan's "independence".
Karzai has opened up a big lead as the front-runner, but a poll this week suggested he would fail to win an outright majority and face a run-off six weeks later against Abdullah.
Abdullah whose campaign momentum has surprised Western diplomats, held a rally in Kandahar on Wednesday - rare in the violent south - and flew on Thursday to the northern city of Mazar-e-Sharif for another gathering.
Karzai urged supporters in Kabul to come out and vote .
He said: "Don't be worried about the threats.
"People are saying the election will be disturbed, there will be explosions. Let them try to disrupt the elections. We will go to vote, even if there are a hundred explosions.
"We will go to vote for the success of the country."
Civilians bear the brunt of violence in Afghanistan, which has reached record proportions eight years after the 2001 US-led invasion overthrew the Taliban regime and installed a Western-backed administration.
The United Nations has said more than 1,000 civilians were killed during the conflict in the first six months of 2009, up almost a quarter over the same period last year