The Taliban claimed responsibility, saying the soldier joined the army in order to carry out his attack in Kapisa province, in the volatile east of the country where many of the 3,700 French troops in Afghanistan are based.
The insurgent group, which has been waging a 10-year insurgency against US-led NATO and Afghan forces, also said they carried out a roadside bombing in the southern province of Helmand that killed 10 local police.
"An individual wearing an Afghan National Army uniform turned his weapon against two International Security Assistance Forces service members in eastern Afghanistan, today, killing both service members," an ISAF statement said.
The Taliban, who frequently exaggerate their claims, said three French soldiers were killed and several others wounded.
"Ibrahim (the soldier)... achieved his aim by taking out three French invading troops and wounding a number of them after he opened fire," spokesman Zabihullah Mujahid said on their website.
The perpetrator was also killed, he added.
The incident brings the total number of coalition military fatalities this year to 563, according to an AFP tally based on independent website iCasualty.org, down from a wartime high of 711 in 2010.
This year has been the bloodiest so far for French troops, with 26 killed.
The latest victims were members of the French Foreign Legion, Paris confirmed.
"During a support mission with the Afghan National Army (ANA) in the Tagab valley, the two non-commissioned officers were mortally wounded by deliberate fire from an Afghan soldier," the French presidency said.
Afghan defence and provincial officials said they could not confirm whether the attacker was a soldier or an impostor.
"We can neither confirm nor deny that he was an Afghan soldier. We are still investigating," said defence ministry spokesman General Mohammad Zaher Azimi.
In a series of incidents, Afghan government security forces, or those purporting to be, have turned their weapons on foreign troops.
In one of the biggest such attacks, an Afghan air force officer killed eight American troops and a US contractor at Kabul airport in April.
Last week, an Afghan soldier was killed after opening fire on US troops in southwestern Farah province.
Under a flagship strategy designed to allow foreign combat troops to leave by the end of 2014, NATO has built up the Afghan army to 180,000 troops.
But fears have been raised over possible Taliban infiltration because of rapid recruitment.
Roadside bombs remain the biggest killer in the conflict, increasingly used by insurgents to inflict a heavy toll on security forces and civilians.
One such bomb Thursday killed 10 Afghan police returning from a recruitment centre in Helmand, the local government said.
The victims were members of the US-funded Afghan Local Police (ALP) set up last year and touted as key to the security handover by 2014.
"Ten local police were killed and one was injured after their vehicle struck a roadside bomb in the Nad-e Ali district of Helmand province," provincial governor's spokesman Daud Ahmadi said.
"Our mujahedeen fighters attacked a police vehicle and as a result 10 police were killed including a police commander," claimed Taliban spokesman Qari Yousuf Ahmadi.
Parts of Helmand remain highly unstable, although Nad-e Ali was one of the districts where President Hamid Karzai said security would be handed from NATO to Afghan control in a second wave of transition.
British forces have been operating in the district since 2006 and recently said the joint security effort had led to an 86 percent drop in violence this year compared to 2010.
The ALP arms local residents to protect their communities in areas where the Afghan army and regular police have limited reach.
It does not have law enforcement powers and is due to more than triple in size to 30,000. Critics have called it little more than a militia but NATO says the community force helps bolster security in rural areas.