I know the exact episode you’re talking about. Someone bought me a DVD collection a few years ago with some Andy Griffith episodes on it. That’s one of them. It’s a good one.
Great show. Went really downhill when Don Knotts had to fulfill his movie contract, but even at its worst, it was still better than many shows that came after.