In a ceremony at the Pentagon Mr Ghani paid tribute to US soldiers who had fought in Afghanistan and thanked the US for its support.
In September, Mr Ghani signed a deal allowing foreign troops to stay beyond 2014.
US troops ended their combat mission in December.
Speaking in front of US soldiers and military families, Mr Ghani acknowledged US sacrifices throughout the war in Afghanistan.
"Each one of you has left a legacy," he said, noting that more than 2,200 Americans lost their lives and 20,000 were wounded in the conflict.
He also paid tribute to Washington's financial commitment, saying US efforts to rebuild the country's infrastructure and bring schooling to three million girls had made a discernible difference to the lives of the Afghan people.
Afghanistan did "not want to be burden" in future, he said. "We do not now ask what the US can do for us... we want to say what Afghanistan will do for itself and for the world," he added.
His words of gratitude are in sharp contrast with those of his predecessor, Hamid Karzai, who left office last year, accusing the US of inflicting a war on his country that had intensified with the drawdown of foreign forces.
"This is a different relationship than we had under President Karzai. It's clearly more co-operative and better," said senior White House official Jeffrey Eggers.
US and other foreign forces no longer engage in combat action, having handed over security responsibility to Afghan forces during the course of 2014.
Foreign troops have kept up a presence in Afghanistan in a training and advisory role.
Last May, President Barack Obama promised to bring back all US troops by the end of his term in 2016, but observers say the US is keen to keep military bases in the region for longer.
After his speech at the Pentagon, Mr Ghani, who is visiting the US together with his Chief Executive Abdullah Abdullah, moved on to the presidential retreat of Camp David for talks with US Secretary of State John Kerry.
He will meet President Obama on Tuesday and address Congress in Washington on Wednesday.
So far, Congress has approved more than $60bn (Â£40,23bn) to equip, train and sustain Afghan forces, with the Pentagon asking for a further $3.8bn in 2016.
Afghan President Ashraf Ghani has praised the US for the commitment shown to Afghanistan over 14 years during his first official visit to Washington.