To the extent you can teach critical reasoning; the emotions of compassion, kindness, and empathy; and Enlightenment or humanistic values (under whatever name you want to call them), then teach those things. But you will never eliminate fanaticism altogether, you will only at best ameliorate it. It is too deeply rooted in human nature to be truly weeded out.
By the way, so long as we're on the subject, it's well known to psychologists these days, but not so much to the general public, that rationality is not strongly correlated with intelligence. That is, the assumption that the smarter you are the more rational you are doesn't have much empirical evidence in its favor. Rationality -- like creativity -- is not a necessary property of high intelligence.
There are a whole lot of very smart, but relatively irrational folks in this world who lack the creativity to think much outside the boxes of their culture and upbringing.