Environmental concerns are currently a major issue in the maritime transportation industry. A practical approach to implementing green maritime transportation is to adopt liquefied natural gas (LNG) as marine fuel. Government subsidies would efficiently stimulate the adoption of LNG in maritime transportation as marine fuel. However, the question of how to determine the appropriate amount of subsidies has not yet been investigated in depth. In this paper, a trilevel programming model is proposed to address the subsidy optimization problem. Decisions at the government, port, and ship levels are integrated into the model, which aims to maximize the social benefit government's net profit. Based on the behavior rules of ship operators, a tailored method is proposed to convert the bilevel (port level and ship level) problem into an equivalent single-level problem. Embedded in an enumeration algorithm, the method significantly reduces the difficulty of solving the problem. A series of numerical experiments with realistic parameters were conducted to show the significance of this study and validate the proposed model and algorithm.