As various environments such as fine dust changing recently, there are many changes in agriculture. In particular, plants that grow in an environment where fine dust contains heavy metals are very dangerous for food. Because eating plants contaminated with heavy metals can be very harmful to human health. In light of this, plant factory is recognized as an important technology to solve this problem. So, this study is about how to design and operate plant factory using artificial intelligence. The results of the study were as follows. Plant factory can produce plants without time and space constraints by artificially controlling the environment. In plant factory, automation using the Internet of Things and artificial intelligence is recognized as a key technology during the Fourth Industrial Revolution. Using these technologies, plants can be automatically controlled and produced on a planned basis. Artificial intelligence collects the results of plant factory and goes through a deep learning process. Through this deep learning process, artificial intelligence analyzes the optimal cultivation conditions of crops. Plant factory targets to automatically provide an optimal environment for each crop. And, plant factory can farm by utilizing city buildings or idle spaces. So, this is the core agricultural technology of the future society. It also suggests how to use artificial intelligence in plant factory. This research result can be used as theoretical basic data in the design and construction of plant factory in urban idle space.