The risks of diseases and economical losses resulting from aflatoxin contamination to the agricultural products are a significant problem. In this study, a prototype system for real-time detection and separation of dried figs contaminated with aflatoxins was developed and tested. The main components of the system are 365 nm wavelength UV light sources, CCD cameras, optical sensors, image processing and automation software, belt conveyors that carry dried figs, and automatic separation units in a dark room. Four UV black-light lamps were installed on the aluminum roof of both the belt conveyor systems, to enhance the effectiveness of reflective illumination of the dried figs in the detection leg of the process. The monitoring set up consisted of two cameras with high resolution and low distortion 9 mm lenses, and two CCD color sensors. The imaging system, which had an exposure time of 8.12 ms, could capture images of dried fig samples moving on the belt at speeds of 0.18 m s(-1) and 0.06 m s(-1) for belt 1 and belt 2, respectively. The system uses two cameras, as both sides of the dried figs were required to be scanned. Figs contaminated with aflatoxins can be separated pneumatically, by an automatic separation system. The prototype system was tested by using 400 dried figs. The prototype system achieved a 98% success rate in the detection and separation of the dried figs contaminated with aflatoxins. Turnover efficiency and hourly machine capacity of the system were calculated as 82% and 34.56 kg/h, respectively. Additionally, total system efficiency was calculated as 80.36%. Thus, the system was found effective and convenient for real-time detection and separation of the dried figs contaminated with aflatoxins.