Stress can cause symptoms. Also, do you think it is possible he is making up symptoms to get out of class because he is bored and frustrated? Or do you believe he actually feels ill? Are you picking him up early from school when he has these symptoms? The fact that he doesn't have them at home seems very telling.
I do believe school stress can cause symptoms, but I also know from personal experience that a 6 year old can figure out that pretending to be sick can get him out of doing things that he doesn't want to do.
Can you tell the teacher that you think it may be because of stress due to a lack of challenge, and ask her to give him more challenging work to see if it helps?