I'm looking for a good translation of the word dirty, in the sense of
Morally unclean; obscene or indecent, especially sexually. (Wiktionary)
Ein __ Witz
Which word could I use?
The proper translation would be schmutzig:
Er erzählte einen schmutzigen Witz
The word dreckig is less often used in this sense, but will be understood as well.
"Obszön" would be a good choice when speaking or writing in a more formal context.
Another related alternative would be “versaut”, literally “spoiled”, and with much the same connotation.
The difference between the German “versaut” and English “spoiled” – and the reason why it can also be used in the sense of “dirty” – is this: A “spoiled joke” is a joke badly told. But a “versauter Witz” (usually) means a dirty joke.
(Likewise, you can’t say “das ist eine versaute Frucht” to warn somebody off eating a spoiled apple.)
Ein schlüpfriger Witz.
Unflätig may also make sense as a translation:
Unflätige Worte, Gedanken
For some uses (e.g. joke), it's used less often today though.