A magistrate said there was a high risk of “catastrophic consequences” if he granted bail to a teenager accused of stockpiling weapons and explosive chemicals.