There was “a stand-off firing for about 15-20 minutes” when the militants opened fire at around 5am.
“The troops were on alert and the attack was foiled,” he said.
Indian Army Spokesman Colonel Rajesh Kalia said the militants fired at sentry posts and tried to enter the camp in the forested Langate area. The camp is the local headquarters of the counterinsurgency military unit.
He added that the soldiers repulsed the attack, killing the suspected rebels. Three automatic rifles and ammunition were recovered from their bodies, it emerged.
The Indian army suffered no casualties, Kalia said.
A search operation was reportedly launched in the adjoining areas after the attack.
Separately on Thursday, soldiers intercepted three groups of suspected militants at two locations along the Line of Control, killing at least one militant, the Indian army claimed.
An officer, speaking on condition of anonymity said the militants were trying to enter the IHK. However, there is no independent confirmation of the incidents.
This is the second attack on an Indian army camp in five days. On Sunday, at least one trooper of the Border Security Force (BSF) was killed and another injured in a similar attack on an army camp at Baramulla town of IHK.