The history is just about as solid as the spelling in Quentin Tarantino’s “Inglourious Basterds,” but the movie is rip-roaring fun anyway. Though it borrows its title (while perverting it), and a bit of its plot, from a 1978 spaghetti rip-off of “The Dirty Dozen,” it’s really a homage to multiple wartime films, and it eschews its model’s incessant action in favor of long dialogue sequences in which Tarantino can exhibit his flair for flavorful dialogue and tense staging.

In fact, the film opens with the best of these—the extended questioning of a taciturn farmer (Denis Menochet) in occupied France by a Nazi officer named Hans Landa (Christoph Waltz) about a Jewish family that’s gone into hiding. As a combination of crisp writing, beautifully calibrated direction and great acting, it could hardly be improved on. The only drawback is that it’s so good that the rest of the film never quite matches it.

Nor does the rest of the cast quite measure up to Waltz, who luxuriates in Tarantino’s ripe dialogue and pregnant pauses to offer a portrait of cheerful villainy that dominates things even during his character’s absence. But there’s plenty of room for others to make their mark. There’s Lt. Aldo Raine (Brad Pitt, doing an ultra-macho bit with a thick Southern accent), who leads the titular group of Jewish soldiers behind enemy lines, where they become notorious for ambushing and killing German troops. And Bridget von Hammersmark (Diane Kruger), a German movie star who also happens to be a British spy and part of a plot to assassinate Nazi bigwigs. And Shosanna (Melanie Laurent), a Jewish girl who escapes Landa’s dragnet to become the operator of a cinema in Paris, where German war hero Frederick Zoller (Daniel Bruhl) is so enamored of her that he persuades Joseph Goebbels (Sylvester Groth) to premiere the new Nazi epic celebrating his exploits at her theatre. Hitler himself (Martin Wuttke) will be among the distinguished guests, a catalogue of the Third Reich’s upper echelon.

They all come together in the picture’s big last act, which juxtaposes Goebbels’ premiere with Raine’s mission and Shosanna’s revenge. Happily Landa’s there too, as cruelly astute and gleefully malevolent as ever, and with evil plans of his own.

Given its Italian pedigree, one might have expected “Basterds” to be a non-stop orgy of action set-pieces. But in reality they’re surprisingly few, and the most spectacular of them—the final confrontation at Shosanna’s theatre—is actually rather clumsily choreographed, given Tarantino’s flair for such things. What really distinguishes the picture is the dialogue, especially in two long, twisty verbal episodes that show Tarantino at his most characteristic. The first is that brilliant opening between Waltz and Menochet. The second, less successful of the two involves Von Hammersmark, British agent Archie Hicox (Michael Fassbender), Raine’s man Hugo Stiglitz (Til Schweiger) and an SS officer (Gedeon Burkhard)—as well as a one of those gun-against-gun standoffs that have become obligatory in both Tarantino pictures and their numerous imitators. Both are well staged and written, but the first generates real tension, while the second comes across as more of an exercise. (It also helps, of course, that Waltz carries the earlier of them.)

The rest of the script has its share of good lines, but they’re intermittent, and stranded among less inspired material. The interplay among the Basterds doesn’t work terribly well, not only because Pitt depends too heavily on his oversized drawl, but because the others are played by guys like Eli Roth, a director (“Hostel”) who may be a buddy of Tarantino but is no great shakes as an actor. (He comes across like a dull version of Zachary Quinto.) The Von Hammersmark-Hicox subplot is stilted, not just because Kruger and Fassbender never get beyond parody but because it also features brief turns by badly made-up Mike Myers and Rod Taylor as a British general and Winston Churchill, respectively. And though the Shosanna-Zoller thread is better, Bruhl proves surprisingly bland, and while Groth lends a touch of mad menace to Goebbels, Wuttke’s comic-villain Hitler is only a touch better than Dick Shawn’s clown Fuhrer in “The Producers.”

And yet the appearances by Waltz are enough to save things, and fortunately they’re sufficiently frequent—and smartly spaced (two of his very best moments coming at the beginning and end, with an almost-as-good episode tossed almost precisely between them)—to make the film worth seeing. He’s so mercilessly good every second he holds the screen, in scenes in which Landa ranges from absolute viciousness to almost giddy delight in his own cleverness, that one only regrets that the rest of the picture isn’t up to his standard.

From a purely visual point of view “Basterds” is great. David Wasco’s production design, the art direction from a team headed by Sebastian Krawinkel, and Anna B. Sheppard’s costuming are all superb, and the widescreen cinematography by Robert Richardson is gorgeous in a creamy, elegant way that’s almost the direct opposite of its Italian semi-namesake. The score reflects the director’s movie-buff tastes, ranging from the odd use of “The Green Leaves of Summer” under the titles to lots of Morricone excerpts.

“Inglourious Basterds” is long at two-and-a-half hours, and the paucity of simple action sequences may disappoint dyed-in-the-wool Tarantino fans. But so long as you don’t mind twisted history and elaborate riffs on genre convention, you should find that there’s much to savor here, not least Waltz’s magnetic villainy.