Shul bans "racist" Tanya but see here.
I believe that this is a basic Kabbalistic doctrine and is not specific to Tanya at all.
For instance from Eitz Chaim (R' Chaim Vital) 48:2 -
אמנם עכו"ם אין בהם רק בחי' נפש לבד מצד הנוקבא של הקליפות
בס' 'אורות', אורות ישראל פ"ה פיסקה י (ע' קנו) כותב הרב קוק: "ההבדל שבין הנשמה הישראלית, עצמיותה, מאוייה הפנימיים, שאיפתה, תכונתה ועמדתה, ובין נשמת הגוים כולם, לכל דרגותיהם, הוא יותר גדול ועמוק, מההבדל שבין נפש האדם ונפש הבהמה, שבין האחרונים רק הבדל כמותי נמצא, אבל בין הראשונים שורר הבדל עצמי איכותי".
And many more - see here
[See LazerA's insightful comment. I saw something similar in the Ben Ish Chai's ShuT Teshuvas Torah L'Shmoh (see the last מקבציאל) in which he suggests that someone with small handwriting is only "b'bechinos nefesh" whereas someone with big handwriting is "b'bchinos neshomoh" and another similar analysis based on the shape of the beard.
It is further important to note that many of the peasants in pre-modern times were "illiterate, unwashed, permanatly drunk" and similar adjectives and so it is not hard to understand where the above sentiment is coming from. (cf. the following from H. Soloveitchik's - Halacha, Hermenutucs and Martyrdom:
Then there was the revulsion. Franco-German Jewry saw themselves as living among murderous barbarians, little different from beasts [emphasis mine - W.]. The pride of place given to the warrior in feudal society was in their eyes an endorsement of violence and bloodshed. Judgment by ordeal revealed a people bereft of rational thinking and a society devoid of justice. Christians of the Midi, proud heirs of a millennia old Roman culture, despised the northern barbarians, Jews even more so. Perhaps the view of the ‘‘natives’’ held by white settlers in Africa in the late nineteenth century came closest to those of Jewish parents in the medieval German Empire. The thought that their child might grow up a murderous savage must have filled them with horror.)
See Kevin's post for an excellent, nuanced presentation of the position of the Gentile in the world-view of the Sages (based on J. Neusner's Theology of the Oral Torah).
See also Emes L'Yaakov Genesis 9:25 for a very sharp refutation of the claim that Judaism is a "racist" religion.]