  Context. Previous attempts to separate Small Magellanic Cloud (SMC) stars
from the Milky Way (MW) foreground stars are based only on the proper motions
of the stars. Aims. In this paper we develop a statistical classification
technique to effectively separate the SMC stars from the MW stars using a wider
set of Gaia data. We aim to reduce the possible contamination from MW stars
compared to previous strategies. Methods. The new strategy is based on neural
network classifier, applied to the bulk of the Gaia DR3 data. We produce three
samples of stars flagged as SMC members, with varying levels of completeness
and purity, obtained by application of this classifier. Using different test
samples we validate these classification results and we compare them with the
results of the selection technique employed in the Gaia Collaboration papers,
which was based solely on the proper motions. Results. The contamination of MW
in each of the three SMC samples is estimated to be in the 10-40%; the "best
case" in this range is obtained for bright stars (G > 16), which belong to the
Vlos sub-samples, and the "worst case" for the full SMC sample determined by
using very stringent criteria based on StarHorse distances. A further check
based on the comparison with a nearby area with uniform sky density indicates
that the global contamination in our samples is probably close to the low end
of the range, around 10%. Conclusions. We provide three selections of SMC star
samples with different degrees of purity and completeness, for which we
estimate a low contamination level and have successfully validated using SMC RR
Lyrae, SMC Cepheids and SMC/MW StarHorse samples.
