The soldiers were in a four-wheel drive car near a market about 25 km (15 miles) east of Khost when they came under attack on Friday, Commander Sattar, deputy head of the provincial border force, told Reuters.
Two men driving in another car overtook the soldiers' vehicle and then attacked it, he said.
"Apart from the soldiers' car, the two were the only people driving on the road. We have arrested them and believe they are Taliban," Sattar said.
At the scene of the attack, witnesses saw a burnt-out vehicle and three bodies charred beyond recognition.
The soldiers were recruits to Afghanistan's fledgling national army and served along the border with Pakistan. They had been shopping at a market.
None of the rockets fired at the US positions caused casualties and damage, according to a US military spokesman.
“Three to four rockets were fired art border checkpoint number four in the vicinity of the firebase at Khost last night (Thursday), ” Colonel Rodney Davis told reporters at Bagram air base, north of Kabul.
Davis was unable to say who fired the rockets but similar attacks have been blamed on Taliban and al-Qaida holdouts or fighters loyal to former Afghan prime minister Gulbuddin Hekmatyar.
About 19 months after the toppling of the Taliban regime, a 11,500-strong US coalition force continues to hunt the militia and its allies, mainly in southern and eastern regions bordering Pakistan.
Is Taliban coming back?
Karzai says Taliban "finished"
Afghan President Hamid Karzai has repeatedly denied that the Taliban was making a comeback in Afghanistan.
"The Taliban and their terrorist associates are defeated completely in Afghanistan... they're finished, they're gone, they're in hiding,” Karzai told the BBC in an interview last month.
However, he conceded that individuals, or small groups of three or so people, were still capable of carrying out attacks.
In early June 46 people died in the biggest clash in more than one year between government forces and suspected Taliban fighters in the south of the country.