David Cameron was speaking to them at an event to mark the monarch's 90th birthday.
In an apparent reference to the anti-corruption conference he is hosting in London later this week, he can be heard telling the Queen and Most Revd Justin Welby: "We've got the leaders of some fantastically corrupt countries coming to Britain."
The Archbishop is heard to intervene to make clear that "this particular president" of Nigeria is not himself corrupt.
David Cameron overheard calling Nigeria and Afghanistan 'fantastically corrupt countries' https://t.co/GlWopXnX4mhttps://t.co/hXqjfb3P2q
— ITV News (@itvnews) May 10, 2016
The footage was obtained by ITV News from the Buckingham Palace event.
Number 10 has declined to comment but did say the leaders of both countries had acknowledged the scale of the problem they faced.
Mr Cameron - who is stood next to Commons leader Chris Grayling in the group - said that the summit had been discussed at a "very successful" Cabinet meeting earlier.
A spokesperson from Lambeth Palace told Premier the Archbishop "has no particular view on the specific countries but supports the International Anti-Corruption Summit to combat corruption in all walks of life."