Panic attacks cause IBS, and IBS causes panic attacks. It's that chicken and the egg thing. Sometimes people get panicky and then get IBS, and sometimes people get IBS symptoms and start to panic.
And this doesn't have to be either/or. Many people do both. Meaning they both bring on IBS with a panic attack and IBS brings on panic attacks.
So it's both right and wrong that you are "causing" your IBS; sometimes you probably are and sometimes you probably aren't. But this isn't a time to stop and condemn you, because only a few divas actually induce panic attacks on purpose; you and most everyone else doesn't want to have them any more than you want to have a fit of IBS. Just because you "caused" your IBS by having a panic attack doesn't mean that you had a panic attack on purpose.
However, if you can learn to control the panic attacks, you can get rid of some of your IBS fits. At the very least, you will make the situation better by not having both IBS and a panic attack.
It sounds like you started to get IBS symptoms and this pushed you into a panic attack. Whether your symptoms then got worse because of the panic attack is anyone's guess. But the fact that you might have not have gotten worse if you could have controlled the attack makes it worth the effort, I think.
What you need to work on with your therapist is how to get through the panic attacks. Mostly this consists of breathing techniques, but it may also have an element of mental imagry (you know, envision a beautiful beach sort of thing). It may also involve exercise; if you take a walk and get your feet moving and concentrate on that, it's harder for your body to tense up and go into a full-blown attack. For many people, the more they work on getting through an attack and not letting it get full-blown, the less prone they are to have one. It's like your body gets out of the habit of doing it to you when it feels stressed; you teach it new things to do when it feels that way.
If you can't get a decent therapist who will work with you on overcoming your panic attacks, then you can help yourself a bit by reading up on Eastern meditation; that's where most of the practices for dealing with stress come from. You may also see if you can get into a yoga or taichi class because they teach deep breathing and usually have an element of meditative work in their classes as well. I got to take some Tai Chi classes when I was in Ireland and I always went outside from my class afterwards feeling so good. "Fresh" is the word I would use for it, like the air after a spring rain. Or, if your parents will pay for it, try seeing a holistic doctor. Even if you don't want to try herbs or supplements or acupuntcure or anything like that, a holistic docotor is much more likely to listen to you and to give you exercises or direct you to something that will help you quell your panic attacks.
In addition to getting rid of the panic attacks, meditation, deep-breathing and/or exercising can also help lessen the severity of the IBS. I have found the more you pay attention to your IBS, the worse it gets. When you felt trapped in your classroom, your IBS attack got worse and worse; however, when you were on free time to wander around and visit friends, your IBS was lessened. This is because you didn't feel trapped and because you had your mind on your friends. So if you get like that in class again and can't focus your attention on what's going on, you might try retreating into writing a journal entry on something OTHER than how you feel right now. You might discuss with yourself what you want to do this weekend or when you go to college or how you like a certain person of the opposite sex, or you might even try writing a fictional story. While it's generally not good to spend all of your class time with your mind elsewhere, it may help you not feel so bad when the IBS comes. Just learn to look up to the front regularly, as if you are taking notes.
(Do you think I've done this a time or two?)