dirty one's hands

[dirty one's hands] or [soil one's hands] {v. phr.} To lower or hurt one's character or good name; do a bad or shameful thing.

The teacher warned the children not to dirty their hands by cheating in the examination.

I would not soil my hands by going with bad people and doing bad things.