1640s (in Latin form in English from 1580s), "continued discourse, critical dissertation" (senses now archaic), from French diatribe (15c.) and directly from Latin diatriba "learned discussion," from Greek diatribe "employment, study," in Plato, "discourse," literally "a wearing away (of time), a waste of time," from dia "away" (see dia-) + tribein "to wear, rub," from PIE root *tere- (1) "to rub, turn." For sense evolution, compare school (n.1).
The modern meaning "a strain of invective, a bitter and violent criticism" by 1804, apparently from French.