Fighters aligned to the so-called Islamic State group on Wednesday attacked the troops with heavy guns and rocket-propelled grenades as they travelled outside the town of Gubio, triggering a fierce battle.
"We lost seven soldiers when the pickup conveying the troops was hit by an RPG," said the officer, asking not to be identified.
Another military source confirmed the attack by fighters from the Islamic State West Africa Province (ISWAP) group but did not give a death toll.
The Islamic State group's propaganda arm issued a statement and short video claiming its fighters killed 14 troops and captured two others in the attack, according to SITE Intelligence which monitors jihadist activities worldwide.
The jihadists said they seized weapons and ammunition as well as a military truck in the ambush.
The military officer insisted "nobody was captured alive" and dismissed the IS claims as propaganda.
He said the insurgents "lost a truck and some fighters in the ambush".
ISWAP is a splinter faction that broke away from Boko Haram in 2016.
It has focused on attacking the military since mid-2018 while Boko Haram is known for hitting civilian targets.
The decade-long jihadist conflict in northeast Nigeria has killed 35,000 people and displaced around two million from their homes.
The violence had spread to neighbouring Niger, Chad and Cameroon, prompting a regional military coalition to fight the militants.