All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
It is not permissible for a woman to play the role of a man in a play or the like.
Shaykh Ibn ‘Uthaymeen was asked, “What are the conditions that must be fulfilled to make acting permissible?”
He mentioned a number of conditions, including the following fourth condition, “A man must not play the role of a woman and a woman must not play the role of a man.”
He forbade it because a woman is Islamically forbidden from imitating men, and a man is forbidden from imitating women.
Ibn ‘Abbaas, may Allah be pleased with him, narrated that the Prophet said, “Allah has cursed men who imitate women and women who imitate men.” [Al-Bukhaari]
Moreover, Abu Hurayrah, may Allah be pleased with him, narrated that the Prophet cursed a man who wears the dress of women and a woman who wears the dress of men. [Ahmad and Abu Daawood]
There is no difference in this case as to whether it is done seriously or jokingly and whether it is done in the presence of men or in the presence of women (only).
Allah knows best.