Despite its serious themes, Maria Bamford’s “Lady Dynamite” is stuffed with jokes, visual and verbal, to the point that it’s like a tottery Jenga game. Courtesy Netflix

There’s a great song in the musical “[title of show]” that asserts, “I’d rather be nine people’s favorite thing / Than a hundred people’s ninth favorite thing.” For two decades, that’s been Maria Bamford’s brand. She’s played small roles on sitcoms; she was the spokeswoman for Target. But the purest Bamford essence could always be found in her dreamy, destabilizing standup routines, which dealt head on with time spent in mental institutions, struggling with a bipolar II diagnosis and an assortment of crippling O.C.D.-ish compulsions. In her YouTube series “The Maria Bamford Show,” which was set in Duluth, Minnesota, where she’d retreated after a breakdown, Bamford played not only herself but various family members, frenemies, and dates—while crooning to her psychiatrist, “If I keep the ice-cube trays filled, then no one will dieeeeeeeee.” In her self-distributed show, “Special Special Special,” she performed in her living room, with only her parents as an audience.

When I first heard about “Lady Dynamite,” Bamford’s new Netflix series, I felt apprehensive, having been burned, in recent months, by too many floppy, over-extended dramedies produced by streaming neworks, such as “Love” and “Casual.” These shows, like “Lady Dynamite,” often dealt with dysfunctional, single Los Angelenos, often on the fringes of the entertainment world, unable to commit to love. But then I watched the first “Lady Dynamite,” and the second, and the third, and soon the weekend was gone and I had to start watching the show all over again, from scratch. Like “Arrested Development,” whose creator, Mitch Hurwitz, co-produced “Lady Dynamite” with Pam Brady (a longtime collaborator with Matt Stone and Trey Parker), the series is not a dramedy but a true comedy. Despite (or because of) the show’s serious themes, it’s stuffed with jokes, visual and verbal, to the point that it’s like a tottery Jenga game. The pilot leans a bit heavily on the meta-comedy—it features a debate between Bamford and Patton Oswalt about how to structure the series—but after that it becomes a real joyride. In certain ways, “Lady Dynamite” shares ground with the terrific “BoJack Horseman,” another comedy about the difficulty of distinguishing ordinary Hollywood misery from genuine mental illness. But it has a distinct vibe, somehow at once celebratory and melancholic, with a hallucinogenic edge. It performs a small miracle by expanding Bamford’s story just enough to make it feel sitcom-like while still maintaining her voice.

The central plot of “Lady Dynamite” tracks Bamford’s Pilgrim’s Progress toward a balanced life in Hollywood, braiding together three separate timelines, each filmed in a slightly different style. There’s “Past,” a bright-neon era from before her nervous breakdown, when Bamford was doing that high-paying gig for Target (satirized, scathingly, as the union-busting Checklist) but was also careening through bad friendships and awful relationships, ascending toward full-blown hypomania. There’s the gray-blue “Duluth,” set after Bamford moved back in with her Midwestern parents, having been institutionalized for suicidal depression. And there is “Present,” in which Bamford is medicated, gamely trying to restart her Hollywood career, and dating again, while struggling not to repeat the choices she’s made in the past. Each episode ends with a plaintive strain of Dean Martin, with the resonant lyrics, “I don’t know what I’m doing / More than half of the tiiiime.” As with H.B.O.’s “Enlightened,” “Lady Dynamite” is a show that frequently satirizes New Age and therapy speak but that nonetheless has faith in their bedrock ideals.

None of this complicated blend would work without Bamford’s fascinating, hard-to-describe, explosively brittle performance style. A tiny, tense figure in her forties, Bamford has scared-looking eyes and a pointy nose and straw-like (or, sometimes, crazily permed) blond hair, and she holds her shoulders hunched as if in eternal apology; she’s a bit like a comedic Cindy Sherman, using her unthreatening Hollywood-blonde blankness as a screen to project something that’s far stranger and more out of control. She’s fragile, but her jokes are hard. She’s also a skilled shape-shifter who can perform multiple voices—a sexy rich lady, a shrieking cartoon character—who nonetheless seems trapped in her own spasming physicality. In the tradition of performers like Andy Kaufman and Paul Reubens, she’s constantly wincing and screaming and contorting her face, yet she’s also quite sweet, almost deceptively so. One of the smartest things about “Lady Dynamite” is that it doesn’t rely on a self-pitying portrait of Bamford as a pure victim of those around her. Yes, she is a people-pleaser who gets bullied by false friends and crazy agents. Sure, she gets engaged to a newly divorced stuntman with bad credit. But she is also pathologically passive-aggressive in response to any sign of conflict—during one relationship, she hides in the shower and stuffs a sponge into her mouth so that she can scream after every phony, awful interaction. As the episodes elapse, the show builds a fascinating and nuanced portrait of a woman whose magical gifts aren’t all that inseparable from what makes her a little bit impossible.

Many episodes deal with Bamford’s adventures in a modern Hollywood determined to monetize her eccentricity. She tries to “Trojan horse” some feminist commentary into a bad network sitcom; she foolishly gives up a role to a Sarah Silverman, who sends her on a scavenger hunt to win it back. She appears in a violent, surreal Japanese ad for a product called “Pussy Noodle” and attends a terrifying corporate “pitchapalooza” involving Wendie Malick and a sandwich. Along the way, she’s steamrolled by a trio of lacquered feminine advisers—an agent, a real-estate broker, and a life coach—all named Karen Grisham. The agent, an incredible Ana Gasteyer, is a pure force of hilarious malevolence, goading Maria into singing a career theme song that consists of nothing but “cradle the balls and work the shaft.” Bamford also has two very funny friends, who are played with languid savoir-faire and undermining narcissism, respectively, by Bridget Everett and Lennon Parham.

“Why can’t I look into people’s eyes anymore?” Bamford asks her wise, German-accented pug dog, Burt, in a sequence set in Duluth. “Did a spirit-vandal come and break my soul windows?” “Knife feelings!” she screams, running into the Hollywood Hills after her new boyfriend tells her a little too much about his childhood. The show is often at its sharpest when examining the difficulty of maintaining enough vulnerability to let the world in, but not so much that it destroys you. Mania is a disease, but it’s also Bamford’s shtick. Her employers don’t necessarily want her to get better—they just want her to stay upright.

There are plenty of avant-garde shows these days that you could compare “Lady Dynamite” to, a renaissance of comedies that follow the advice of “Nine People’s Favorite Thing”: “We can either follow our instinct / Or take advice from every joker / We can either be distinct / Or wind up merely mediocre.” It has some of the sad-sack blend of realism and surrealism of “Louie”; it works the cringe-comedy edges established by “Curb Your Enthusiasm.” In the grand tradition of “The Pee-wee Herman Show," it's built in a far-out psychedelic dream world, where pugs speak and her house says “Maria’s House” on the roof. Bamford’s extreme physical performance—her willingness to be ugly, shrieky, and needy—reminded me of Lisa Kudrow’s spectacular turn on “The Comeback,” Lena Dunham on “Girls,” or even Eden Sher’s spazzy-heroic Sue Heck on “The Middle.” She has the slapstick verve of the “Broad City” chicks; she also has the brass to delve into the true misery of Andy Daly’s “Review.”

But, in certain ways, I was most reminded of the genius nineteen-nineties comedy “Strangers With Candy,” in which Amy Sedaris uglifies herself as a damaged middle-aged junkie named Jerri Blank, who goes back to finish high school, learning a new lesson every week. “Strangers” was a harsh parody of an Afterschool Special, but it also made you fall in love with the perverse, screwed-up ignorance of Jerri Blank: her urge to embrace, and sometimes molest, a world that mostly glared at her in alarm. Bamford is a much kinder, gentler figure than Jerri—for all her mental illness, she’s a grownup who wants to be happy and good and successful—but she shares some of that same hapless intensity. In the final episodes of “Lady Dynamite,” as Bamford gets some of the love she seeks, the show veers very slightly toward the sentimental. But it’s impossible to judge, by that point: “Lady Dynamite,” like Bamford herself, has earned both your forgiveness and your affection.