But he was actually speaking to two Russian pranksters, his office said.
During the chat, the hoaxers raised the idea of using animal manure and homemade alcohol as a source of fuel.
The pranksters are known for targeting high-profile politicians and celebrities, including Arizona Senator John McCain and singer Elton John.
Vladimir Kuznetsov and Alexei Stolyaro have been identified as the pranksters, who were impersonating Ukrainian Prime Minister Volodymyr Groysman.
"Secretary Perry is the latest target of two Russian pranksters", said Energy Department spokeswoman Shaylyn Hynes.
"These individuals are known for pranking high level officials and celebrities, particularly those who are supportive of an agenda that is not in line with their governments," Ms Hynes added.
"In this case, the energy security of Ukraine," she told the Washington Post.
On 20 June, Mr Perry hosted the Ukrainian president and his delegation in Washington.
On 12 July, his office received a request for a follow up phone call, and one week later the prank-call took place, US media report.
During the call, the two discussed US coal exports to Ukraine, Russian hackers, a proposed energy pipeline across the Baltic Sea, and a - presumably fake - new source of fuel derived from manure and homemade alcohol.
They claim that the "biological fuel" had been invented by Ukrainian President Petro Poroshenko.
"I hope that stepping away from the Paris accord will not have any negative impact with our relationship with the Ukraine," Mr Perry said at one point during the call, referring to the climate change pact that US President Donald Trump has announced US opposition to.
Mr Perry, the former Texas governor, dropped out of the 2012 presidential election after forgetting the names of the departments that he planned to eliminate if elected during a debate.
"Oops" Mr Perry muttered, rather than recall the name of the department that he would later head.
US Secretary of Energy, Rick Perry talked for 22 minutes on the phone with a man he thought was the prime minister of Ukraine.