I'm reading a paper at the moment and very bored and then I thought if I write a paper, I would like the writing style to be not so boring or having some kind of humor. Is that allowed in academic writing?
"Why so serious?" - Joker.
There is nothing wrong with humour in scientific writing but it is still advised against. The reason for this is a question of communication.
Consider that the purpose is to convey an idea as succinctly and precisely as you can and you want the recipient to understand everything that you write (my experience says this will never happen, anyway). If you introduce jokes, you run several risks: (1) the reader does not understand the joke, (2) the reader misunderstands the joke and (3) the reader is offended by the joke. These are not outcomes you wish to see and realizing that not everyone's taste is like your own it is easy top realize that the outcome is sure to be one of the three above in some cases. Jokes are different in different cultures and countries so what works in one place may not work in another.
So, as I see it the choice is how much you are willing to gamble. Reviewers and editors may of course weed out things that go too far so what you write is not necessarily what comes into print in the end but it still is mostly up to you.