For maximum possible cantrips, you take Mage Initiate and Spell Sniper, 4 levels in warlock, 1 level sorcerer, 1 cleric (Arcana), 2 druid (circle of the land), 1 wizard, 1 bard, 4 levels in eldritch knight fighter and 4 levels in arcane trickster rogue. It's horribly sub-optimal, but it gives you 28 cantrips in total.

Edit: @Neil Slater pointed out Arcana Domain gets more cantrips. Changed to show for it.