When people say they need or want something like a hole in the head, it means that they don't need or want it, not even one little bit! Not at all! Emphatically not!
No one needs a hole in the head — it's clearly a bad thing, not good for anybody! In fact, it's downright bad. The phrase like a hole in the head is typically used after or with the verb need or want. It expresses in a hyperbolic way that it's something NOT wanted or needed. Do you want another pop quiz in math class? If definitely not, you might say, "I want another pop quiz like a hole in the head!" Do you need another monthly car payment like a hole in the head? Then you really don't need that!