Sandro (Jon Hudson Odom, left) and Leo (James Crichton) fall in love in the time of the plague in “Botticelli in the Fire.” (Scott Suchman)

Canadian playwright Jordan Tannahill was reading an art history textbook a few years ago when a footnote caught his eye: In 1497, a fanatical Dominican friar named Girolamo Savonarola incited hordes of people in Florence, Italy, to burn their art, books, mirrors and other symbols of vanity. Renaissance painter Sandro Botticelli, known for “The Birth of Venus,” joined in the purge.

“I read this story about Sandro Botticelli willingly burning his own masterpieces in the Bonfire of the Vanities, and I tried to get inside what would have provoked him to do that,” Tannahill says.

Tannahill was struck by some other historical facts, too: Botticelli and Leonardo da Vinci trained together in the same workshop in Florence. They were also accused (separately) of sodomy — a crime punishable by death on the pyre.

“This ahistorical but emotionally plausible narrative began to form,” Tannahill says, one where the protagonist must choose between renouncing his life’s work and renouncing the love of his life. The result, Tannahill’s play “Botticelli in the Fire,” opened on Monday at Woolly Mammoth Theatre.

To keep his narrative accessible, Tannahill eschewed the trappings of a 15th-century period play and imbued the show with 21st-century sensibilities. This Sandro Botticelli (played by Jon Hudson Odom) listens to techno, relishes brunch and constantly loses his cellphone. He’s also an unapologetic, pansexual hedonist.

“People would come up to me at a party and they’d be just dripping with jealousy,” Sandro says directly to the audience during the play. “I remember this one queen, he said to me, ‘I heard you once had an orgy with 30 people that lasted a whole weekend.’ And I was like: ‘Once?’ Please. Do your research, girl. Do. Your. Research. ‘Once’ — cute.”

Outside the windows of Sandro’s art studio in downtown Florence, people are dying in the streets from the bubonic plague. But the wealthy still need their art, including Lorenzo di Medici (Cody Nickell), the city’s de facto ruler, who commissions Sandro to paint a portrait of his wife, Clarice Orsini (Alyssa Wilmoth Keegan). Clarice poses nude for Sandro for what will become “The Birth of Venus,” and a lusty affair ensues.

Meanwhile, sexual tension rises between Sandro and his young, brilliant assistant “Leo” da Vinci (James Crichton). Late one night, Sandro reaches for Leo — and the tension bursts into frenzied passion.

“It’s definitely a sexy show,” Tannahill says. “I love that frisson between beauty and sexuality and sensuality — but when they are brought together, it can be very messy.”

Messy turns catastrophic when Lorenzo suspects Sandro and Clarice are having an affair. His jealousy soon heightens to a murderous rage aimed at Sandro and, by association, Leo.

That’s not the only threat. Out on the streets, homophobic friar Savonarola (Craig Wallace) is stirring up the common people’s anger about the Black Death and blaming the ills of society on seekers of pleasure, particularly sodomites. As Savonarola’s followers burn gay people in the piazza, Sandro and Leo quickly become targets.

The artists must escape both the angry mobs and Lorenzo’s wrath. But even the greatest of sacrifices and the most Faustian of deals are not guaranteed to save them.

For Tannahill, “Botticelli in the Fire” is a way to reclaim the untold stories of gay artists who have been persecuted throughout history — stories that they never got to tell themselves.

“It is about the rise of populism. It is about the enduring spirit of queer survival,” Tannahill says. “It is about the politics of pleasure, and how pleasure and vice are often scapegoated to political ends.”

Woolly Mammoth Theatre, 641 D St. NW; through June 24, $20-$59.

More things to do in D.C. this weekend: 

The Capitol Hill Film Classic festival makes its debut and 2 other movies to see

Learn the secrets of the “Hamilton” set with its designer

A couple’s passion for Radiohead and Planned Parenthood sparks a unique benefit at the Black Cat