This is one of the hardest things to write. You can write a novel about an era like the victory era, that even if you don't know anything about that time, you can research it and understand it perfectly to reflect it when writing to your readers.
But comedy is subjective, what makes someone laugh can make someone else feel offended. But even so, you can always try a little of everything to see if you are good at it.
Although I have written quite a few funny scenes in my novel, I don't know if many of them are funny to begin with (mainly because no one ever comments, damn ghosts) What I use mainly is a context or lack of it. Someone who is knowledgeable may find something funny while a person who doesn't have that information finds it strange (a.k.a. internet memes).
For example, the joke about when you are in Vietnam and the trees start to talk. For someone, an American who watches comedy frequently finds out what is being talked about because it makes you laugh. While someone from Peru wouldn't know why it's funny.While you may see that someone who was fighting there does not do him the slightest bit of grace and feels insulted.
But sometimes it's also funny when someone doesn't understand the context, it doesn't have to be the readers, maybe a character in the story is the one who doesn't understand the context.
In my novel, the protagonist (a man) ends up in the body of a young girl (I know, original on this website). He meets his family and explains the situation to them and they don't give it much importance (that's not what the series is about). So in a certain chapter, it seems like a character (a yandere) who steals from him, his family stops her, and throws the stolen content into the street of the neighborhood. Obviously, the clothes are for a girl, but then the main character's sister yells that these are her BROTHER's clothes. For the family and the reader, they know that there was a logic behind what she said, but for the neighbor who was passing, she thought of something else entirely.
There is also fun when there is no explanation. A mysterious box that arouses curiosity but never gets an answer, the imagination fills in the blanks. For example, the elevator of the TV series The Big Band Theory, where you never knew why it was broken and nobody wanted to tell, each chapter had a different cause, and not knowing which was correct was what made it funny.
Even the repetition can be funny, for example the main character's mother, a Latin woman, wears a "chancla" a sandal with which she hits everyone to calm the situation. The first time her power is established, the third time her mere presence is a threat. The seventh time you already know that she is going to pass psychologically speaking.
Then one day you see her buying a new pair of sandals.
Another day you go to the garden and you find these
And one day he arrives at the grandmother and sees that you have to respect her at any price
And for heaven's sake, never explain the joke. Just like the joker said in batman, if you have to explain the joke it means it's not funny