Lindsay Lohan can take a joke -- even when she's the butt of it ... and she wasted no time teeing off on her latest rehab stint while guest hosting "Chelsea Lately."
Linds just wrapped her first gig since getting out of rehab on Tuesday -- and sources inside the show tell us she freely cracked jokes like, "I've been on a 90-day court ordered vacation."
In LiLo's defense ... she probably didn't write the jokes.
We're told Lindsay also busted on Chelsea Handler for drinking too much -- and overall was "very funny" ... especially during the round table segment with comedians Jen Kirkman and Fortune Feimster.
Linds also got some eye candy for her troubles -- getting to interview Dylan Bruce from the BBC show "Orphan Black."
Don't say Chelsea never did anything for you, Lindsay.
The taped episode is scheduled to air Monday.