In Billy Wilder’s postwar Berlin comedy, “A Foreign Affair,” Marlene Dietrich plays a nightclub singer who once shared her bed with a high-ranking Nazi and let Hitler kiss her hand. Her current lover, an American officer, asks, “How much of a Nazi were you, anyway?” She responds: “What does it matter, a woman’s politics? Women pick out whatever’s in fashion and change it like a spring hat.”

Dietrich could play that role with relish and imbue it with ironic elan partly because off-screen she was an adamant anti-Nazi who became an American citizen and a tireless booster of the Allied war effort. Her “Foreign Affair” character was closer to Leni Riefenstahl, who graduated from starring in “mountain” films (and directed one of her own, “The Blue Light” ) to creating the Nazi propaganda epic “Triumph of the Will.”

German historian Karin Wieland presents both these women in an agile biography titled “Dietrich & Riefenstahl.” It depicts Riefenstahl as an ambitious artiste who aimed to achieve success by any route, Hitler or Hollywood — and found that Hitler proved the better fit. She embraced “Mein Kampf” and befriended its author. She removed Jewish colleagues’ names from her directorial debut and later used gypsy concentration-camp inmates as extras. As Wieland puts it: “Hitler was not a temporal power in her eyes; he was a miraculous, inexplicable phenomenon. The artist-ruler Hitler created a world for which Riefenstahl, as his court-artist, provided the visual representation.”

“Dietrich & Riefenstahl” was originally subtitled “Der Traum von der neuen Frau.” “The dream of the new woman” summarizes this book’s hypnotic power. It focuses on two young women from traditional homes who carved out groundbreaking careers and maintained unconventional private lives with similar audacity. Both juggled multiple lovers; the bisexual Dietrich also married early, raised a daughter and supported her never-divorced husband throughout their lives. But Dietrich and Riefenstahl diverged on the crucial civic and moral decision of their day: to back Hitler or renounce him.

In her own whitewashing memoir, published in the United States in 1992, Riefenstahl declared that she was ignorant of National Socialism’s anti-Semitic policies and stayed independent of the party’s ideology even after the Nazis seized power. Sixteen years later, Steven Bach’s biography “Leni” used the recollections of contemporaries and historical records to take apart her myth of political naivete.

From left, Marlene Dietrich, Anna May Wong and Leni Riefenstahl at the Berlin Ball in 1928. (Harvard Art Museums/Busch-Reisinger Museum, Gift of Lufthansa German Airlines/ )

Wieland isn’t as brilliant a prosecutor as Bach, and she doesn’t immediately zero in on the director’s fascist tendencies. But Wieland’s patient depiction of girls coming of age between world wars has its own sneak-attack power. You are fascinated as Riefenstahl succumbs to the Nazi promise of German force. You are appalled as she decides that “only the admiration and support of the omnipotent dictator would be suitable for her genius.”

Early on, Riefenstahl aspired to be a starlet in the world of “expressive dance.” A knee injury thwarted her. What continued to distinguish her performances, though, were strength and physical beauty — the qualities she displayed as an outdoor adventure star in films like “The White Hell of Pitz Palu.”

Dietrich found her niche in Weimar Berlin’s booming theatrical bohemia, which “mimicked and mocked high society” while toppling sexual norms. She instinctively and imaginatively fit into its cabaret culture. She assembled signature props, such as a monocle, using this “former symbol of class superiority as an accessory for a femme fatale who knew the wishes and rules of men and would not let any gentleman play her for a fool.”

The Vienna-born American director Josef von Sternberg sensed Dietrich’s potential and turned her into a tantalizing camera subject as Lola-Lola, the amoral, prematurely world-weary club singer in “The Blue Angel.” Dietrich skyrocketed to international fame. Von Sternberg became her artistic guru and lover.

As the narrative bounces between Berlin and Hollywood, Wieland deftly portrays Dietrich and von Sternberg as the Trilby and Svengali of the movies. They created films that ranged from the erotic milestone of “Morocco” to the mesmerizing camp of “Shanghai Express” until their amorous and creative partnership wore thin and follies like “The Scarlet Empress” alienated their audiences. Wieland gets some details wrong, and her taste is highfalutin’. She doesn’t realize that Dietrich’s sensational comeback film, George Marshall’s “Destry Rides Again,” is a comedy. But Wieland does understand that Dietrich took everything she learned from von Sternberg and employed it spiritedly for other auteurs.

Meanwhile, Riefenstahl hitched herself to Hitler’s dark star. “Triumph of the Will,” her chronicle of the 1934 Nuremberg Party Rally, employed rhythmic editing and massive compositions to achieve an overwhelming visceral effect. It also epitomized what Milan Kundera calls “totalitarian kitsch,” which banishes “every display of individualism . . . every doubt . . . all irony.” By depicting the Third Reich as a sublime setting for the 1936 Olympics, “Olympia” also functioned as Nazi propaganda. But in this film, Riefenstahl’s love for athletes transcended her political intent. She respected them as individuals and, between shots of her beaming Führer, responded to their feats with knockout artistry.

Wieland’s writing can be too abstract. She says that when Dietrich died in 1992, “the image outlived her; art had prevailed,” and when Riefenstahl died in 2002, “death had released her from art.” Such statements are more melodramatic than illuminating.

German filmmaker Leni Riefenstahl and cameraman Walter Frentz are wheeled along by an assistant at the 1936 Berlin Olympics, the subject of the film “Olympia.” (Keystone/Hulton Archive/Getty Images/ )

Wieland sees both women as prisoners of their art. In this biographer’s view, “Marlene Dietrich” — the idealized image of herself — became Dietrich’s true masterpiece. In old age she refused to undercut it by going out or being photographed. Riefenstahl’s determination to capture primal beauty with sophisticated techniques, whether shooting African tribes or underwater species, became a form of escapism — a way to evade questions about her past.

Bach wrote in “Leni” that there was little “meaningful comparison” between the beloved star and the notorious director. Wieland’s book proves him wrong. She uses these two virtuosos’ lives to generate piercing insights about ambition, ego, creativity and the life-changing, world-altering repercussions of a momentous choice.

Michael Sragow is the West Coast editor and online film critic for Film Comment and the author of “Victor Fleming: An American Movie Master.”

Hollywood, Berlin, and a Century in Two Lives

By Karin Wieland

Translated from the German by Shelley Frisch

Liveright. 612 pp. $35