I don't know if it's OK to make those jokes, but it's infinitely preferable to say it out loud explicitly and deal with it with humor than to just make fun of them for being weird and acting different like on big bang theory, where sheldon is clearly modeled after someone on the spectrum but with few redeeming qualities.
I guess it's more acceptable to make jokes about a mental illness that (a) has been abandoned as meaningless, and that (b) can make you rich and/or famous (Bill Gates and Albert Einstein were both assigned the diagnosis).
It can't be compared to the cruel jokes I would hear in school about anyone below average either physically or mentally. It's in a different category.