>>438779965th or 6th Gym
Lucid Badge, which would just be basically a very tiny mirror
TM - Protect
The Gym is modeled after/is a mental clinic/lab. The entrance is a waiting room that's full to the brim with both Trainers and staff. Talking to them and the people around town reveals to you that the Leader is well known for his other jobs as a physiotherapist and psychotherapist, but he's also infamous for stopping Gym Challenges, as a good portion of the Trainers in town are there for retries.
Talking to a receptionist, you are led into what's basically a doctor's office with a Pokémon arena on the side. The Doctor there asks you questions about hypothetical scenarios, with a trainer who answered differently than you being called in after each question.
After going through the questions, you battle the doctor. After you beat them though, they reveal they're just an intern that wanted to battle you after watching your matches, and then actually give you your test results on whether you answered satisfactorily or not. Either way, you're told you can now go through a door in the back to meet the leader, but are warned you're better off reflecting on yourself and retaking the test.
Inside, you finally meet the Leader, who comments on your answers and your battles. He explains that he keeps tabs on every Trainer that comes by from the moment they enter the town through his eyes in the townsfolk and local Pokémon, and he uses the test in the Gym to decide whether or not he thinks they have the mental and moral fiber to earn his badge.
If your answers were to his liking, he straight gives you the badge, but says you can still battle him for the formality with the "therapy" team. If they were not, he says he's obligated to still let you try to earn your badge in battle, but doing so has you battle the "control" team in an SOS battle with a Gym effect that harshly lowers all of your stats by one stage every turn, and a time limit of 10 turns.