Rachel S. answered 08/01/19
Patient and Organized Tutor Specializing in Test Prep
Both sentences are technically fine. Your teacher is correct in that "I don't think he likes it" is the preferable construction in writing; it is more direct.
In speech, people might use "I think he doesn't like it" because of regional speech variations, or for other reasons. But, in writing, it requires readers to shift, which is not ideal. The phrase "I think" is "positive," but "he doesn't like it" is negative. Shifting in a written sentence, like that, is awkward.
"I don't think" sets your readers expectation right off, and is a more direct way of making the point. I hope that helps!