Shortly after escaping the near mirthless company of "The Apple Dumpling Gang Rides Again," I caught the closing minutes of a Buster Keaton compilation on Home Box Office. The contrast was startling and the tonic effect instantaneous.

Every minute of the Keaton footage teemed with comic invention and vitality, shaming the whole enervating length of "Dumpling," the latest uninspired attempt at juvenile comedy from the Disney studio. Of course, few contemporary filmmakers could stand comparison with Keaton. Nevertheless, Disney's product is unlikely to improve unless the producers, however modest their talents, try to derive some inspiration from the liveliest traditions of movie comedy.

Far from harking back to invigorating sources, "The Apple Dumpling Gang Rides Again" is content to deepen the rut left four years ago by its predecessor, "The Apple Dumpling Gang," one of the dreariest Disney artifacts of the decade but a comfortable box-office success. Tim Conway and Don Knotts, who had supporting roles in the earlier film as bumbling would-be outlaws, have been promoted to comic leads in the sequel, where their characters blunder into a series of misfortunes after trying to go straight in a frontier town.

Conway and Knotts don't lack comic traits or skills. In act, Conway has been one of the most inspired and satisfying comic performancers on American television over the last several years. The creative brilliance he's shown as a second banana with the Carol Burnett bunch has never been properly cultivated by the Disney crowd as often as Conway has appeared in Disney comedies. The atmosphere seems too groggy and the situations too stilted to accomodate his sneaky, spontaneous genius.

The director, Vincent McEveety, doesn't seem to want more from Conway than moronic stares and double-takes or more from Knotts than jumpy peevishness. He prefers to linger on these set attitudes from such cramped camera angles that they exhaust their humorous capital almost at once, especially when perceived on a large screen.

It's at least a scenic relief when exteriors shot near Sonora, Calif., and Kanab, Utah, replace the Western facades and interiors on the Disney backlot. I don't know if the crew also felt liberated from studio convention or if the second unit was simply better at its work, but these fleeting landscapes and a night fire sequence staged on location give the film its few signs of pictorial life. Every depiction of a sustained comic interlude suffers from perfunctory enactment and ragged editing.

Richard X. Slattery, Ruth Buzzi and Jack Elam rise above the stodgy surroundings with enjoyable performances as a cavalry sergeant, an outspoken biddy and an outlaw mastermind respectively. Tim Matheson, who was rising to prominence in "Animal House" while "Dumping" was in production, narrowly survives an unflattering moustache and ill-fitting uniform in the thankless role of the young romantic lead, an Army intelligence officer posing as a cavalry trooper, destined to pair off with the daughter of commandant Harry Morgan.

"The Apple Dumpling Gang Rides Again" will remind you that you should have taken the kids to something that might be more fun for everyone, like "Meatballs" or "Moonraker" or "Smokey" and The Bandit" or "Jaws" or one of the vintage adventure melodramas in revival at the American Film Institute Theater. CAPTION: Picture, Tim Conway