Legislators in the EU have long been concerned with the environmental impact of farming activities. As a means to mitigate adverse ecological effects and foster desirable ecosystem services in agriculture, the EU introduced so-called agri-environment schemes (AES). This study suggests a machine learning method based on generalized random forests (GRF) for assessing the environmental effectiveness of such agri-environment payment schemes at the farm-level. We exploit a set of more than 130 contextual predictors to assess the individual impact of participating in agri-environment schemes in the EU. Results from our empirical application for Southeast Germany suggest the existence of heterogeneous impacts of environmental subsidies on mineral fertiliser quantities, greenhouse gas emissions and crop diversity. Individual treatment effects largely differ from traditionally used average treatment effects, thus indicating the importance of considering the farming context in agricultural policy evaluation. Furthermore, we provide important insights into the optimal targeting of agrienvironment schemes for maximising the environmental efficacy of existing policies.