In a national address before leaving the presidential palace, Mr Karzai said the peace process had failed because "America did not want peace".
The US ambassador said the remarks dishonoured America's war dead. Mr Karzai has long attacked the US for causing too many civilian casualties.
A national unity government takes power on Monday after a bitterly fought vote.
In his farewell speech, Mr Karzai said the war was not among Afghans but "for the objectives of foreigners".
He said a friendly relationship with the United States was possible, but only if their words matched their actions. He strongly criticised Afghanistan's neighbour Pakistan, too, saying it wanted to control Afghan foreign policy.
"If America and Pakistan really want it, peace will come to Afghanistan," Mr Karzai said.
"War in Afghanistan is based on the aims of foreigners. The war in Afghanistan is to the benefit of foreigners. But Afghans on both sides are the sacrificial lambs and victims of this war."