A Sydney man has been charged over an alleged threat to kill the Prime Minister before this year's federal election.