A non-citizen can be tried for treason.
The Supreme Court ruled in Carlisle v. United States, 83 U.S. 147 (1872) that aliens in the United States owe a temporary allegiance to the United States and can be charged with treason. Quoting Secretary of State Daniel Webster, Justice Field said,
“Independently of a residence with intention to continue such residence; independently of any domiciliation; independently of the taking of any oath of allegiance or of renouncing any former allegiance, it is well known that by the public law, an alien or a stranger born, for so long a time as he continues within the dominions of a foreign government, owes obedience to the laws of that government and may be punished for treason or other crimes as a native-born subject might be unless his case is varied by some treaty stipulation,” 83 US at 155.
From the syllabus:
“Aliens domiciled in the United States owe a local and temporary allegiance to the government of the United States; they are bound to obey all the laws of the country not immediately relating to citizenship during their residence in it, and are equally amenable with citizens for any infraction of those laws. Those aliens who, being domiciled in the country prior to the rebellion, gave aid and comfort to the rebellion were therefore subject to be prosecuted for violation of the laws of the United States against treason and for giving aid and comfort to the rebellion,”
83 US at 148.