How can a doctor know if a child has autism or mental impairment?

See below. The distinction maybe hard to determine. However a good history and some screening tests will aid in the diagnosis. Plus observation is a very strong tool.
Evaluation. Evaluation, generally, but not always done by ph. D, psy. D, or master's level psychologists that includes tests of IQ such as the wisc-iv and standardized evaluations for autism spectrum symptoms such as the ados or gilliam scale help a professional to determine is an autistic spectrum disorder is present.
40-68 % of children. With autistic spectrum disorder also have intellectual disability. School districts' child find teams & specialty teams of developmental/behavioral pediatricians, child neuropsychologists, et al, assess cognition as well as degree of asd. Social reciprocity & social communication are assessed at developmental, not chronological, age, as are observable patterns of behavior characteristic of asd.