Today, some complex problems are known as NP-hard problems. For this category of problems, there is no exact solution or they are not solvable in a reasonable time. For this reason, metaheuristic algorithms have been introduced and developed. These algorithms attempt to find an optimal solution to the problem instead of finding a definite solution. In recent years, these algorithms have gained significant attention from researchers. The major inspiration for metaheuristic algorithms is nature and its laws. An important category of these algorithms is evolutionary algorithms. These algorithms are inspired by the behavior of animals and living organisms that exhibit social and intelligent behavior. However, each metaheuristic algorithm may optimally solve just some types of problems. Therefore, researchers continuously try to introduce new algorithms. In this study, a new metaheuristic algorithm called Farmer Ants Optimization Algorithm (FAOA) is introduced. This algorithm is based on the intelligent life of farmer ants. Farmer ants cultivate mushrooms to provide food for themselves. They also protect them against various pests, and after growth, feed them. These special behaviors of farmer ants, which are based on their social life, are the source of inspiration for the proposed method. Experiments on some engineering and classical problems have shown that FAOA can provide an acceptable solution for discrete optimization problems.