Immigration officials have detained a Boston high school student suspected of threatening to “shoot up” the school.