Both are possible, but they may not mean exactly the same thing. "I got treated like dirt over nothing" means that the offence that led to your being treated like dirt was trivial. "I got treated like dirt for nothing" could mean the same, or it could mean that no benefit accrued to you from the events that involved or led to your being treated like dirt.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.