A common listing in a job posting or question during a screening for jobs that may require a clearance is something along the lines of "you are authorized to work in the US" and "you must be able to obtain and maintain a security clearance". Those are relevant to the job and also disqualify people for reasons other than citizenship, both of which are safe and legal to inquire about (it's OK to ask about convictions, not about arrests, for example).
Based on my research, there are some questions about citizenship that are allowed and some that are not. In my experience, it's one of the subjects that HR instructs screeners and interviewers to avoid, preferring questions that are sure to be safe and minimize potential problems with the candidates.
In rare cases, non-US citizens can be granted security clearances by the Department of State or given a Limited Access Agreement by the Department of Defense for information classified no higher than Secret. However, there must be evidence to support these requests, such as the inability to on-board a US person in sufficient time or special knowledge/skills.