This is inaccurate. As per https://www.irs.gov/individuals/international-taxpayers/substantial-presence-test, when calculating the number of days in the US for the substantial presence test, you do not count the days you are an "exempt individual". This includes a few categories of temporary visitors, in particular:
A student temporarily present in the U.S. under an "F," "J," "M," or "Q" visa, who substantially complies with the requirements of the visa.
As a result most foreign students in the US are not residents for tax purposes. This has important tax implications since they often are not eligible for the same tax benefits as those classified as "residents" for tax purposes (which includes, not is not limited to, US citizens and permanent residents) and hence often pay higher rates of taxes.
OP, I suggest you review https://www.irs.gov/individuals/international-taxpayers/determining-an-individuals-tax-residency-status. Quoting from that page,
If you don't meet either of those two tests, then the foreign spouse may have to submit the election to be treated as a resident for tax purposes. For more info see https://www.irs.gov/individuals/international-taxpayers/nonresident-spouse