He writes fine with the spec. ed teacher, but could end up doing nothing in class. It depends on whether he likes the topic or if he spaces out.
I don't know your ds, so I maybe it is this, but if there's an LD at play the difference in output between the classroom and working with the SPED teacher might be due to something completely different from either not liking the topic or simply spacing out. For instance, simply working one on one could mean his anxiety over working on a frustrating subject is significantly reduced. The SPED teacher may also be giving him more specific or structured directions, she may be prompting him when he's stuck etc.
I'd also dig a bit to determine what's happening when he does "space out" - this happened a lot with my son - or what looked like spacing out - was because he was lost and didn't know what to do. When you think your ds doesn't like a topic or isn't interested in it, look closely at the type of topic - is it writing on a topic that he has knowledge of, or is it an open-ended question about something that may require him to organize new thoughts in his head?
polarbear
ps - when our ds was in early elementary, part of what made it difficult to recognize that he had an LD related to written expression was the nature of how writing was approached in the classroom - each assignment was different in some way from the previous assignment, so it wasn't easy to see ds was having difficulty with x/y/z but was able to accomplish a/b/c - because one day the class was told to write about x using y method, the next day they'd be writing an a story based on b method etc. Because he could do a/b/c but not x/y/z, it looked like there were days he was trying and days he was just spacing out or not trying. Plus many young children don't come out and say "I can't do this because ___" - they don't know why they can't do it or why it's tough. So the communication that they "can't" do it or it's tough is coming through staring out into space, losing focus, paying attention to other things, acting out, whatever - basically they are communicating in a way that's easily mistaken for lack of interest or lack of motivation etc.