It's both, the narrative is sexist but the series of events is... uh, not a good joke? The context and circumstances of the question are also unclear.
This is like when a black person refers to another with the n*-word, it's often sarcastic banter, but a white person can't use it as a joke.
Or, that the factual account of events in itself generally can't be sexist, while a story made up for illustrating particular point of gender almost certainly is.
And that if you tell a joke about a Jew using stereotypes about a Jewish person, it's a different matter entirely from when you tell the same joke about different ethnicity.