The endlessly ingenious Suzan-Lori Parks has found a brilliant way to dramatize one of history’s most fraught relationships: between Thomas Jefferson and Sally Hemings, an enslaved woman whom historians agree bore five of the founding father’s children. In her new play Sally & Tom, which opened Thursday at the Public Theater, Parks frames the tricky 18th-century story with a contemporary yarn about an indie theater company rehearsing an original play about the much disputed couple. You can only imagine challenges the troupe faces grappling with contemporary politics around race and gender and class without alienating the unseen deep-pocketed patron who’s funding the whole project.

The setup allows Parks to explore modern-day parallels to the asymmetrical relationships of early America, and the ways in which even well-meaning people can fall short of their stated principles. Sheria Irving plays not only Sally but the show-within-a-show’s author, who is rewriting her work even during the final dress rehearsals in a frantic attempt to hit just the right tonal note. Gabriel Ebert plays Jefferson as well as the show’s director and the company’s leader, a card-carrying white liberal who wears his well-meaningness as a badge of honor and knee-jerk defense mechanism. He’s also in a long-time romantic relationship with Irving’s character that becomes tested as the show’s top funder suddenly pulls out. How far will he go to keep the show funded?

Parks points out all the ways in which the author of the Declaration of Independence failed to live up to the idea that all men are created equal — not only embarking on a romantic relationship with a woman he owned, but also neglecting to free her on his death. He may have been a brilliant man, but he was also a profligate spender whose plantation was deep in debt. So clinging to an unpaid workforce made a kind of economic sense. “My Negroes make me a yearly profit of 4%. Not bad,” he comments at one point.

Despite all this, and despite the modern director’s own stumbles in trying to get the troupe’s finances in order, Sally & Tom is not just an exercise in tearing down one of history’s giants. The flaws are baked into both men, but Parks and director Steve H. Broadnax III let us see the idealism and potential for even modern-day greatness that lurks within. Not every 21st-century guy would take on a show like this, or agree to play such a flawed hero. “It’s not easy playing TJ,” the modern-day actor-director admits. “Saying the things he said, doing the things he did, being him. It’s actually kind of fucked up.”

The six other members of the cast allow Parks to explore other aspects of contemporary theater-making. We see the perils of stunt-casting as a semifamous performer known as K-Dubb (Alano Miller) who’s cast as Sally’s enslaved chef brother suddenly backs out just before opening night. And the complicated dynamics of race-blind casting with an Asian actress (Sun Mee Chomet) playing one of Jefferson’s white daughters. (“You think there were any Korean-Americans in America in 1790?” she asks. “I’m asking rhetorically, but I mean, like, how much skin do I actually have in this game?”)

I could have used less of some of these Noises Off-style subplots. While Daniel Petzold is a hoot as a comically amateurish actor who keeps fumbling his lines (“Mr. Jefferson in the flush! Flash! Fleish!”), it’s a mystery how even a semi-professional theater troupe with newbies like him could manage to snag an actor with a fan club. Or the money to pay for the stylishly simple set, designed by Riccardo Hernández, which bridges the colonial and the modern periods and yields a powerful surprise just before the curtain call.

No matter. Parks’s Sally & Tom is both a love letter to the theater, to overcoming the challenges of putting on a show no matter the cost, and a thoughtful tribute to the American experiment — a project that is just as noble in its aims and just as flawed in execution.