Agroecology is gaining traction across the global south as part of the potential solutions to food insecurity, soil health loss and degradation and for managing climatic stresses. Yet, there are many sceptics arguing that agroecology cannot sustain the food security needs of a growing population and that probably much more input intensification on the existing lands would be the best alternative as it will allow conservation of crop and forest biodiversity. In this paper, we develop a virtual landscape model (the spatial bioeconomic model for agroecology, SpBiMA) that maximizes economic value from crop production and pixel level crop biodiversity while meeting food consumption needs, and restricting cropland expansion. We then apply this stylized model to a case study in Malawi: a country plagued with very high deforestation rates due to cropland expansion. The spatially explicit model allows us to pinpoint the changes in the spatial footprint of crop production, at landscape level, that will attain the economic and biodiversity goals and simulate if an agroecology practice (e.g., doubled up legume or others) can help in getting to the pareto frontier. We use the model to suggest the different locations where agroecological practices can be targeted in future agricultural and biodiversity investments to minimize the environmental costs while maximizing economic value.