Onion (Allium cepa) is a major field vegetable in South Korea and has been produced for a long time along with cabbage, radish, garlic, and dried peppers. However, as field vegetables, including onions, have recently been imported at low prices, the profitability of onion production in South Korea is beginning to be at risk. In order to maximize farmers’ profits through onion production, this study develops onion yield prediction models via an ensemble learning-based framework involving linear regression, polynomial regression, support vector regression, decision tree, ridge regression, and lasso regression. The use of nitrogen fertilizers is considered an independent variable in the development of the yield prediction model. This is because the use of nitrogen fertilizers accounts for the highest production cost (13.47%) after labor cost (41.21%) and seed cost (17.42%), and it also directly affects onions yields. For the model development, five research datasets on changes in onion yield according to changes in the use of existing nitrogen fertilizers were used. In addition, a non-linear optimization model was devised using onion yield prediction models for the profit maximization of onion production. As a result, the developed non-linear optimization model using polynomial regression enables an increase in profits from onion production by 67.28%.