If this law were to be challenged in court, it would be most likely to be subjected to strict scrutiny. Laws subjected to this level of scrutiny are typically struck down.
Laws that are based on suspect classifications are subjected to strict scrutiny. Race is such a classification. So is national origin. When a law is subjected to strict scrutiny, the state must show that the law is narrowly tailored to achieve a compelling state interest. The law in this hypothetical surely does not achieve any compelling state interest since it is hard to imagine what the point of the law is.