Sounds a lot like me. I am not cured, but I am getting better. Here is what I have learned and am trying to put into practice.
1. You're probably overdriving.
Trying to go faster often means that you overshoot corners, adding distance and time. Or you are sawing away at the wheel and jamming the brakes rather than smooth inputs. The reason you are faster at during fun runs is that you stopped trying desperately to shave time and just relaxed.
2. You probably don't have a plan.
If you come off course and you are 1.5 seconds slower than the next person in class, what are you going to do to shave time? When I started, I simply tried to go faster everywhere, MORE GAS! SLAM BRAKES! CRANK WHEEL! (see above) Now, I walk the course and I have a plan on where to brake, where to look, where to position the car, how to get on boost, etc. If I need to shave time, I think about my run and try to find sections where I was off plan, or my plan was wrong and needs adjustment. Was the car lagging coming out of a corner? Maybe I need to brake earlier so I can get on the gas sooner. Did I have any issues in the slalom? Maybe I can increase speed a bit there. Was I coasting anywhere? Stop that. Etc.
3. You're probably going to fast
Sounds odd, but sometimes you have to slow down to go fast. Coming in too hot means you slide past your brake point, adding distance, killing momentum, and throwing off your line. This might be because you are braking too late, or not hard enough, or because you improved in the last section and now are entering that corner with an extra 10 mph. Coming into a slalom too hot means braking in the middle and trying not to spin. Slow down a bit and you'll shoot right through.
4. You're probably overthinking it
What are your tire pressures? Are the shocks too stiff? I didn't see that guys brake lights on the back half the course, how'd he do that? The Corvette guys are taking a different line, what if I tried that? Maybe I need Firestone Indy 500s? Its easy to get a lot of stuff swirling around, especially if people are adding advice on top of it: "keep your elbows in, keep your head down, don't lift your back foot, swing your hips, keep that elbow straight, loosen your grip, twist your shoulders, keep your knees bent" I HATE GOLF!!!!! THIS IS A STUPID SPORT!!!! Oh, sorry, flashback. But you get the point. Having a plan allows you to focus on what you want to do and tune out distractions. You know your car, you know yourself, trust your gut and work your plan.