The invention relates to a novel indoleamine-2,3-dioxygenase (IDO) inhibitor, as well as a preparation method and an application thereof. The inhibitor is compounds of a formula I or pharmaceutically-acceptable salt, solvate, polymorph, enantiomer or racemic mixture thereof, wherein R1 or R2 is independently selected from H, C1-C5 alkyl, halogen and a substituent of a formula II and either of R1 and R2 is the substituent of the formula II; R3 is an aryl group; and n is equal to 0, 1, 2 or 3. Compared with the know IDO inhibitors, the novel IDO inhibitor has significant inhibitory effect on IDO and can be used for treatment of diseases having IDO-mediated tryptophan metabolic pathway pathological features, such as tumors, cancers, Alzheimer's disease, autoimmune diseases, cataract, psychological disorders, depression and/or anxiety. The preparation method of the novel IDO inhibitor has the advantages of being convenient in operation, having mild reaction conditions and reducing solvent consumption and pollution, thereby facilitating industrial production.