Generally you also want to be fast with your predictions. These Gym Leaders aren't your average trainers. During battle you gotta calm and relax. Play it smart and play it to win. Also like Renzo said it isn't always gonna be singles. You have to have a decent arsenal of moves that you can use to your advantage. For teambuilding, try to get as many flexible pokemon as possible. Pokemon like Conkeldurr have many useful abilities it can use and you can use this to your advantage in battle.
Also if you do feel pressured by having your battle spectated then you can ask the gym leader for a private match. This tip has generally saved many people in battle.