Mr Obama told a crowd gathered for the South by South Lawn festival of technology and music at the White House that the world was in “a race against time” to combat climate change.
The president said the world had an “incomplete” grade on its response to global warming so far, but added that “the good news is we can still pass the test”.
“I tend to be a cautious optimist about our ability to make change,” he said.
White House hopefuls Donald Trump and Hillary Clinton were not mentioned in the discussion, but their presence was nonetheless felt.
DiCaprio, who recently completed a documentary film about climate change, told the White House crowd that he had timed the film to come out before the November 8 presidential election.
The actor, who supports Mrs Clinton’s campaign, said the scientific consensus about the dangers of climate change was in, and “the argument is now over”.
He added: “If you do not believe in climate change, you do not believe in facts or in science. And therefore, in my humble opinion, you should not be allowed to hold public office.”
Mr Trump has repeatedly referred to climate change as a hoax.
DiCaprio’s film Before The Flood got its domestic premiere on the White House lawn after his discussion with the president and climate scientist Katharine Hayhoe.
The South by South Lawn event was designed to replicate the vibe of the South by Southwest festival held annually in Austin, Texas.
It included panel discussions on topics such as “feeding the future” and “fixing real problems” as well as booths and vendors promoting everything from virtual reality technology to fake tattoos.
Tech blogger and entrepreneur Anil Dash said the South Lawn festival was a way to connect the dots between Austin’s SXSW, with its ideas for changing the world, and the people “doing the actual work” to use technology to improve workers’ rights, civil rights and more.
The White House tech fest also featured a student film festival, a wall of art made of Post-Its, Lego statues, demonstrations on the science of food and using technology to help the disabled and lots of music. Among those performing were the Lumineers, Gallant, Black Alley and DJ Bev Bond.
DOWNLOAD THE SCOTSMAN APP ON ITUNES OR GOOGLE PLAY