A teenage boy has been charged after a mosque allegedly received a terror threat only days after it opened.