Cameron had had a short video call with former Ukrainian leader Petro Poroshenko, who was president from 2014 to 2019, but later became concerned.
The hoax was being made public to alert others of the risk and ensure the video was not "manipulated and subsequently used", a Foreign Office statement said. A number of "text messages were exchanged followed by a brief video call between the foreign secretary (Cameron) and someone purporting to be Petro Poroshenko", according to the statement issued on Friday.
"Whilst the video call clearly appeared to be with Mr Poroshenko, following the conversation the foreign secretary became suspicious. "Contact details for others were requested and, given his concerns, the foreign secretary stopped responding," it added. "The department has now investigated and confirmed that it was not genuine and that the messages and video call were a hoax." The statement did not say when the call took place.