That teacher is preparing you unknowingly to take the challenge of the world because such kind of people are found everywhere. You have to learn to ignore all his personal remarks and critical comments by not giving them any importance. Connect with him only for the subject and if there is something you can learn from him. Rest of it you have to learn to ignore.
Most importantly not to escape out of fear otherwise we end up missing so many useful classes due to one difficult teacher.
Affectionately,
Alok Da