The new documentary “Under the Sun” follows an 8-year-old North Korean girl named Zin-mi as she prepares to join the Korean Children’s Union, run by the Workers’ Party. Zin-mi and her parents — her mother works in a soy-milk plant, her father is an engineer at a garment factory — share abundant family meals, ride Pyongyang’s spotless subways and pay their respects at a bronze statue of North Korea’s founder, Kim Il-sung.

There’s just one problem: The action is fake. The North Korean government cast the film, wrote the script and provided guides to feed the actors their lines while managing every detail of the project. In reality, Zin-mi’s father is a journalist, and her mother a cafeteria worker. “Don’t act like you’re acting in a movie,” a guide scolds the girl at one point. “Act naturally, like you do at home.”

So, why did the director Vitaly Mansky, a documentary maker in the cinéma vérité tradition of Frederick Wiseman and D. A. Pennebaker, agree to such an awkward, not to mention morally dubious, arrangement? “My dream of visiting North Korea,” he said, “was the desire to understand something about the past of my country, my family.”

Mr. Mansky, who was born and raised in the Soviet Union, divides his life into two periods: before and after 1991, when the government collapsed and he set out at 28 to document the way people had lived under Communism. “A documentary provides the possibility of riding in a time machine,” he said by Skype from his home in Riga, Latvia. For “Motherland or Death” (2011), he traveled to Socialist Cuba, which he likened to the ’70s-era Soviet Union. “Under the Sun,” which opens theatrically July 6, uses contemporary North Korea as a proxy for Stalin’s Soviet Union.