The gunbattle broke out after militants barricaded themselves inside a home in the village of Karlanyurt, Dagestan Investigative Committee spokesman Rasul Temirbekov told The Associated Press. The fatalities included three security force members and two militants. It wasn't immediately clear if there were other militants at the house.
The village is about 550 kilometres (340 miles) from Sochi, which will host the Winter Olympics from Feb. 7-23.
One of the slain militants, Marat Idrisov, was responsible for a handful of attacks on security officials and religious leaders in southern Russia, including a bombing that killed three in the city of Pyatigorsk, the National Anti-terrorism Committee said.
Dagestan, a predominantly Muslim republic in the North Caucasus region, has been the epicenter of a simmering conflict between a growing Islamic insurgency and Russian security forces.
A top rebel leader in the North Caucasus has called on his followers to attack the Sochi Olympics, and Moscow has vowed to crack down on terrorist activity before the games.