Three US troops were wounded after an Afghan soldier opened fire on them at a base in the southern province of Helmand, the NATO-led Resolute Support mission says.
The soldiers are receiving medical care, the NATO-led training and assistance mission said on Twitter.
A spokesman for the Afghan military in the south of the country said the Afghan special forces soldier was shot dead after firing at the Americans at Camp Shorab air base on Sunday afternoon.
So-called 'green-on-blue' insider attacks by Afghan soldiers on international service members were a major problem several years ago, but now occur less frequently after security measures were improved and the number of foreign troops in the country fell sharply.
Most foreign combat troops withdrew from Afghanistan at the end of 2014, 13 years after they ousted the Taliban from power, but around 13,000 NATO-led soldiers remain to help advise and train Afghan forces fighting a revived Taliban insurgency.
Last May two Romanian soldiers were killed and a third wounded after two members of a local Afghan police unit they were training shot them.
Camp Shorab in Helmand, previously known as Camp Bastion, is a major former US and British base now run by the Afghan army.
Helmand has been one of the most fiercely contested regions of the country, with nearly 1,000 coalition troops killed there since the US-led military intervention in 2001.
The US said in January that about 300 Marines would be sent to Helmand to assist Afghan forces battling the Islamist insurgents in intelligence and logistics matters.