Autism spectrum disorders (ASD) are pervasive neurodevelopmental disorders and generally accompanied by social disorders, verbal or nonverbal communication defects, inability to concentrate and other negative symptoms that affect the autistic person's normal life. However, traditional screening methods are time-consuming and public health resources are limited. This study proposed a novel technique that combined eye-movement data and machine learning algorithms for predicting autistic traits. We converted raw eye movement data into features, trained and tested a model for early screening. In the preliminary experiment, 107 participants (average age = 24.84 ± 5.24 years) wore HTC Vive to watch a VR scene for 15-20 s. We explored eight classification models, among which the ensemble model performed best, with 0.73 accuracy, 0.68 precision, 0.81 recall, 0.74 F1-score, and an area under the curve of 0.90. And in the test experiment, 22 participants (average age = 12.68 ± 7.61 years) diagnosed as ASD took the experiment and the ensemble model showed a recall of 0.77. Eye movement data is an effectively distinguishable tool and we find that the proportion of time to observe figure and animal region continuously can distinguish participants with obvious and unobvious autistic traits effectively in the model. This study focuses on the detection of autistic traits, and proposes a more objective and faster method for undertaking early screening, which provides possibilities to save precious time to intervene and alleviate its symptoms before making a definite diagnosis.