Near the start of “Night at the Museum: Secret of the Tomb,” the third (and presumably final) film in the series that began in 2006, a character played by Matt Frewer in a 1930s prologue—an archaeologist whose team is looting an Egyptian tomb—says that he’s afraid they’re doing something terrible. It’s a remark that turns out to be prophetic in more ways than one: the movie ends the trilogy with a dull thud.

The premise in the script by David Guion and Michael Handelman is that the magical tablet that brings the exhibits in New York’s American Museum of Natural History to life every night is conking out, ruining a black-tie fund-raising event in the process. In order to revive the artifact, Prince Akmenrah (Rami Malek) tells Security Guard Larry Daley (Ben Stiller), they will have to travel to the British Museum to consult with his father Merenkahre (Ben Kingsley). So off they go—accompanied by Teddy Roosevelt (Robin Williams), Sacagawea (Mizuo Peck), Attila (Patrick Gallagher), the pint-sized cowboy Jedediah (Owen Wilson) and Roman general Octavius (Steve Coogan), Crystal the Monkey, Larry’s teen son Nicky (Skyler Gisondo) and (in the screenplay’s worst invention) a Neanderthal called Laa, also played by Stiller. They learn the method of restoring the tablet’s power, but complications arise from the intervention of museum guard Mindy (Rebel Wilson) and a reanimated statue of Sir Lancelot (Dan Stevens).

What’s shocking about the picture is how flaccid and mirthless it is. There’s one moment of visual wit—when Larry, Teddy and Lancelot do battle inside Escher’s lithograph “Relativity”—but otherwise the extensive CGI action is remarkably tedious. Stiller is even more colorless and phlegmatic than in previous installments as Larry, and the supposedly hilarious Laa is a grunting bore. It certainly doesn’t help that the writers insert a lumbering subplot about Larry’s strenuous efforts to persuade Nicky to go to college rather than take a year off to play DJ in Ibiza. Every time they indulge in their desultory father-and-son conversation, what little energy the movie possesses drains away.

Wilson and Coogan try to juice things up, but the material they’re stuck with—including a trip through a ventilation shaft to a model of Pompeii, complete with volcano—leave them pretty much stranded. The same can be said of Wilson, whose scenes come across like desperately unfunny improvisation. And while it may bring a lump to the throat to see Williams again (along with the late Mickey Rooney, who appears in one sequence with Dick Van Dyke and Bill Cobbs), they too are badly used, along with Ricky Gervais, as the AMNH director, and Andrea Martin, who has a throwaway part as a museum secretary. Among the newcomers Kingsley is somnolent, but Stevens brings a lot of energy to a poorly-conceived role. His biggest moment—when Lancelot stumbles into a West End revival of Lerner and Loewe’s “Camelot” with Hugh Jackman playing Arthur—might have been brilliant, but the writers and director Shawn Levy make nothing of it, and all the actor’s intensity can’t make up for the utter lack of inspiration.

“Tomb” strives for a sentimental close, with Larry saying a final farewell to his old museum friends, who are going back into permanent hibernation, before leaving the place himself. But the prolonged final scene with Williams comes close to seeming exploitative. The visual effects, supervised by Erik Nash, are certainly busy enough, and Guillermo Navarro’s cinematography lends an appropriately cartoonish look to the proceedings, but even in that respect the movie is undistinguished.

There’s another prophetic line in the Egyptian prologue that opens “Secret of the Tomb”—a local warns the archaeologists that “The end is coming.” It’s a sentiment that a viewer can hold onto, with fingers crossed, as the picture lumbers toward its (and, one hopes, the whole franchise’s) close.