Fig is one of the major agricultural products which contribute to Turkey's economy. The existence of mold and aflatoxin concentrations in figs, like other agricultural products, negatively affects fig exports. Therefore, figs are manually sorted by workers in factories under ultraviolet illumination (UV) by considering the bright greenish yellow fluorescence they expose under UV light. However, manual selection has high error rate and UV light threatens the worker's healthy. In this study, a nondestructive and high accurate classification system is developed using near infrared spectroscopy. In the proposed study, a strong correlation between surface mold concentration and aflatoxin is obtained. The figs are classified into mold infected and uninfected with 100% accuracy. The developed method is effective on eliminating mold infected figs and aflatoxin contaminated figs.