The guerrillas ambushed the police as they patrolled the main highway linking the capital Kabul with the southern city of Kandahar late Friday, said Gulam Rasool, a government chief in Sharisafar district.
An insurgent rocket slammed into a police car, setting it on fire, but all the officers inside managed to escape, he said.
"The Taliban are intent on disrupting the election," Rasool said. "But we are ready for them. We will stop the terrorist attacks."
He said several automatic weapons and grenades had been found on the bodies of the seven dead rebels. Several other insurgents who took part in the ambush fled.
The attack comes ahead of Sunday's elections, the next key step toward democracy after a quarter century of war. Many people are hoping the polls will sideline the insurgents.
Purported Taliban spokesman Mullah Latif Hakimi on Friday urged Afghans not to take part in the elections, but said Taliban insurgents would not attack civilians going to vote.
He said they would launch attacks only on areas where U.S.-led coalition forces were deployed, and advised civilians to avoid such places.
Information from Hakimi in the past has sometimes proven exaggerated or untrue. Afghan and U.S. military officials say he is believed to speak for factions of the rebel group, though his exact tie to the Taliban leadership cannot be verified independently.
Some 100,000 Afghan police and soldiers and 30,000 foreign troops are on alert across the country to safeguard the polls. In Kandahar and Kabul, road checkpoints have sprung up, with police pulling over vehicles ranging from hay carts to ribbon-decked wedding cars.