James Raj was charged on Tuesday with modifying the contents of a website belonging to the town council that manages Prime Minister Lee Hsien Loong's constituency on October 28.
If found guilty, he could be jailed for up to three years and fined S$10,000.
Raj allegedly hacked the web server from an apartment in Kuala Lumpur, Malaysia, according to a charge sheet seen by Reuters.
A state prosecutor told the court that investigations were still ongoing and asked that Raj be remanded at the Institute of Mental Health (IMH) for psychiatric evaluation. The prosecutor said Raj had told police that he suffers from attention deficit disorder and suicidal tendencies.
Hackers claiming links to international hacking collective Anonymous attacked and defaced several websites in Singapore last week, including the official sites of Prime Minister Lee and President Tony Tan.
Hackers also defaced dozens of websites belonging to Australian businesses and Philippine government agencies, leaving the Anonymous calling card - a mask of Guy Fawkes.
Raj's lawyer M Ravi, a human rights activist, told reporters he has not been allowed access to his client so far, and he could not confirm if Raj was the hacker known as the Messiah or was linked to Anonymous.
"I should have thought that if they had concerns about his mental state, they should have referred him to IMH before taking any statements," he said.
© Thomson Reuters 2013