This work evaluates the potential to produce synthetic nitrogen fertilizers by using sugarcane bagasse gasification in the Sao Paulo state, Brazil, aiming to increase the economic revenues and to decarbonize a chemical sector traditionally based on natural gas. The partial or total substitution of natural gas by consuming bagasse and enabling an intensive import of electricity from the Brazilian electricity mix is studied. The comparative assessment of the alternative production routes considers a reference case in which the residual bagasse is used only to generate surplus power at the cogeneration unit of the sugarcane mill, whereas ammonia is typically produced by consuming only natural gas. Unlike the conventional scenario, the proposed alternative routes employ surplus bagasse to produce ammonia. Regarding the unit exergy cost of ammonia, an increase between 50\% and 100\% is expected for the biomass-based routes (2.4498-3.1780 kJ/kJ(NH3)) when compared to the conventional case (1.5866 kJ/kJ(NH3)). In contrast, the net CO2 emissions balance of the alternative scenario achieve negative values (-2.5017 t(CO2)/t(NH3)), in comparison to the net CO2 positive emissions (1.75 t(CO2)/t(NH3)) of the conventional scenario. Additionally, the best location of the ammonia plant is nearby a sugarcane mill with a milling capacity of 10 Mt/y and 20 km far from another smaller sugarcane mill, in order to achieve an ammonia production potential of 1,200 t(NH3)/day. Concerning the economic analysis, if no carbon taxes are considered, the net present value (NPV) of the alternative scenarios drops up to 52\%, compared to the conventional scenario. Finally, since 1.6 Mt(CO2)/y can be avoided by using the residual bagasse as feedstock in the ammonia plant, the alternative scenarios become competitive vis-a-vis the conventional scenario in terms of NPV when carbon taxes of 40-50 USD/t(CO2) are adopted. In the absence of carbon taxes, the drawback of the seasonality of the sugarcane crops (240 days of operation compared to 340 days for the conventional scenario) contributes to the decrease (39\%-51\%) of the NPV for the alternative scenarios.