The invention relates to a preparation method of tryptanthrin compound and a new application of tryptanthrin compound in preparing indoleamine-2,3-dioxygenase (IDO) inhibitor, in particular to an application of tryptanthrin compound in preparing IDO inhibitor and in preparing medicine for preventing and / or treating diseases having pathological characteristics of tryptophan metabolic disturbance mediated by IDO. The structure of the tryptanthrin compound is shown in formula A in the description, wherein R1 and R2 are respectively and independently selected from hydrogen, nitryl, C1 to C5 alkyl, halogen or piperazinyl. The tryptanthrin compound can be used as an IDO inhibitor with high activity and is used for treating diseases having pathological characteristics of tryptophan metabolic disturbance mediated by IDO such as tumor, cancer, Alzheimer disease, autoimmune disease, cataract, mental block, tristimania, anxiety neurosis, acquired immure deficiency syndrome (AIDS) and other serious diseases, and as a medicinal resource which is very difficult to get, the tryptanthrin compound has good potential on researching and developing new medicine.