The Islamic Lawyers Forum petitioned the Lahore High Court for the order, calling the competition "blasphemous," Pakistan's English language newspaper Dawn reports.
"The court has ordered the government to immediately block Facebook until May 31," says Azhar Siddique, a representative of the lawyers' group.
Organizers of the Facebook contest describe it as a response to Muslim bloggers who issued warnings to the creators of the Comedy Central show "South Park" after the show depicted the Prophet Mohammed in a bear suit.
"We are not trying to slander the average Muslim," the contest creators wrote. "We simply want to show the extremists that threaten to harm people because of their Mohammed depictions that we're not afraid of them."
Any representation of the Prophet Mohammed is considered blasphemous by Muslims.
'Happy' fan videos make Pharrell cry [VIDEO]
Pistorius testifies he didn't consciously pull trigger when he shot girlfriend