Composts are increasingly used to enhance soil health and agricultural sustainability, but their impacts on nitrogen (N) availability are unclear. In a 3‐year field experiment with subsurface drip‐irrigated tomatoes (Solanum lycopersicum), we investigated the effects of food waste and green waste co‐compost (FW) and green waste compost (GW) on yield, nitrogen‐use efficiency (NUE), nitrate leaching potential, and fertilizer N retention. Various combinations of compost rates (0, 9, or 18 t ha−1) and fertilizer N levels (0%, 70%, 85%, and 100% of the recommended rate) were examined, and 15N‐labeled fertilizer was used. In Years 2 and 3, FW and GW either maintained or increased crop yield compared to no compost when 0% or 70% N was applied; however, lower NUE was observed in the compost treatments compared to no compost when 70% or 85% N was supplied. Postharvest, FW showed greater fertilizer N retention in topsoil than GW and controls, while no difference in nitrate leaching potential was found among treatments, except for Year 2 during which FW exhibited the lowest potential. These results suggest that compost can immobilize fertilizer N, reducing its uptake by crops but enhancing soil retention, potentially acting as an N source or a primer of soil N mineralization. Future research is needed to assess compost's impact on N gaseous emissions and distinguish its dual roles as an N source and a soil N mineralization primer. This is essential for developing nutrient management guidelines to minimize N losses.