TL;DR Thomas Carlyle called economics dismal science because economists used supply and demand to argue against slavery and support personal freedom.
I presume that, in supporting slavery (in the West Indies, with the intent of increasing productivity), Carlyle was not himself intending to apply for the position...
I'm not big on cancel culture, but I would gladly participate in a ferocious student protest against this guy being read in schools as if he was some sort of respectable figure. Which is not to say don't read him at all, just point out these really ugly things too.