The X-Files justified its reboot with its latest episode, the messy but creative and energetic “Babylon.” As the first episode that didn’t feel like it was just retreading well-worn ground, it was a surprising burst of energy for the second-to-last episode of the 10th season.

The revival of The X-Files has been of dubious value through its first four episodes. The lows of the first episode haven’t defined the entire reboot, as they threatened, but other than the first half-hour of Darin Morgan’s “Mulder and Scully Meet the Were-Monster”, there haven’t been many highs. The core problem: with only six episodes, The X-Files’ 10th season has looked more like a greatest hits collection than something that exists on its own.

The first episode was very firmly in the vein of a mythology-heavy, Chris Carter season premiere. It was followed by a traditional horror mystery that the show has done dozens of times before. Last week’s “Home Again” suffered from trying to cram two different episode styles into one: the schlocky horror of a “Trashman” dismembering people set to pop music, and the philosophical sadness of Mulder and Scully dealing with a family member’s death. Each of those could have worked on their own, but crammed together, they made the episode feel ridiculous.

Even the Darin Morgan episode, as wonderful as it was sometimes, still fit in the genre of a “Darin Morgan episode,” which, though a relatively small sample at just four episodes, still carried outsized reputation for being funny, smart, tense, and willing to poke holes in the series’ own perception of itself. So I was all prepared to say that this season was the rough equivalent of a much-loved band turning out the hits for a reunion, with a few new songs that sound like weaker versions of the glory days. It’s not bad, it’s just not essential.

“Babylon,” the fifth episode of the season, blows that theory out of the water. It is series creator Chris Carter, who both wrote and directed the episode, in full-on comedy mode. This should be terrifying — his greatest hit in that mode was Season 5’s “The Post-Modern Prometheus” which managed to mix a distinct sense of style and on-target jokes with an incredibly creepy story of rape apology.

But “Babylon” isn’t even that close to “Prometheus.” Its directorial method, instead of being highly stylized like “Prometheus”’ black-and-white, is down-to-Earth for most of the episode. It’s built on banter, almost romantic comedy-style. This works exceptionally well, as it almost is a romantic comedy, built on the presence of two young FBI agents, played by Robbie Amell and Lauren Ambrose, who fill their own Mulder/Scully roles. They split up and hook up with the main characters, which allows for a ton of overlapping banter — not what Chris Carter is known for, but it really works here.

And then it goes nuts, turning into an audacious music video that must be seen to be believed. Has there been choreographed dream sequence dancing in an X-Files before? Combined with a perfectly-timed cameo of beloved lost characters?

The most unfortunate thing about this episode is that all the comedy comes alongside an utterly generic, mildly racist “catch the terrorist sleeper cell” main plot that wouldn’t be out of place in a 24 or a Bones. I found it forgivable, but the whiplash from David Duchovny line-dancing watching a terror cell practice their suicide vests is possibly a little much.

And yet there’s an energy and drive and playfulness and willingness to experiment that were unexpected from any reunion tour. The X-Files, one stop from the end of the line, managed to find that joy and run with it. It ain’t perfect, but “Babylon” is a must-see episode.