Besides for potentially offending your audience, a joke like the one you suggest can also detract from the goal of your presentation, which is presumably to inform or educate your audience.
For example, a couple of years ago I got this email, addressed to all of the authors on a paper I co-authored:
I wanted to write to say that I’m a big fan of your [REDACTED] work—it is a really cool idea that addresses a real problem, and it was great to see the work in this year’s [NAME OF CONFERENCE]. However, the actual talk as presented really bothered me, and I felt that it was important to write to you. Based on conversations during the breaks and at the end of the day, I know that I’m not the only person who feels this way.
The email went on to say that this person, and apparently others at the conference, thought a joke that was part of the talk (which was delivered by my co-author, and which I hadn't seen before) was sexist. Personally I thought the joke was more stupid than offensive, but I was unhappy with my co-author for using it - because when people talk about my paper during the breaks at a conference, I want them to be talking about the content of the work, not a joke that the presenter made. The joke was a distraction from the real goal of the talk.
Jokes are good when they support your goal of educating the audience, but not when they distract from that goal. (And definitely not when they're offensive.)