An engine controller configured to execute: a first intake air amount calculation process (P4; P41) for calculating a first intake air amount (MC1; MCAFM), which serves as a calculated value of an intake air amount of an engine, based on a detected value of an intake air flow rate of an air flowmeter; a second intake air amount calculation process (P5; P5*; P30) for calculating a second intake air amount (MC2; MC2*; MCSM), which serves as a calculated value of an intake air amount of the engine, based on any one of a detected value of an intake pipe pressure and a throttle opening degree instead of the detected value of the intake air flow rate; a determination process (P6, P50) for determining whether intake pulsation in an intake passage of the engine is large by determining whether the pulsation is greater than or equal to a preset determination value (α); a difference amount calculation process (P7, P60) for, when determining in the determination process (P6, P50) that the intake pulsation is not large (S110: NO; S160: YES), calculating a difference amount of the second intake air amount (MC2; MC2*; MCSM) from the first intake air amount (MC1; MCAFM); a calculation mode switching process (P8; P42) for setting the first intake air amount (MC1; MCAFM) as an intake air amount calculated value (MC; MCADJ) of the engine when determining in the determination process (P6, P50) that the intake pulsation is not large (S110: NO; S160: YES), and setting a corrected second intake air amount (MC3; MCSM*), which is a sum of the second intake air amount (MC2; MC2*; MCSM) and the difference amount, as the intake air amount calculated value (MC; MCADJ) when determining in the determination process (P6, P50) that the intake pulsation is large (S110: YES); and an injector driving process for performing a fuel injection control on an injector by determining a fuel injection amount (QINJ) based on the set intake air amount calculated value (MC,MCADJ), wherein the engine controller is further configured to perform learning of, in the difference amount calculation process, a difference amount learning value (DEV[i]), which is a learning value of the difference amount, for each of difference amount learning regions (R[i]) divided from one another in accordance with a rotation speed of the engine. a first intake air amount calculation process (P4; P41) for calculating a first intake air amount (MC1; MCAFM), which serves as a calculated value of an intake air amount of an engine, based on a detected value of an intake air flow rate of an air flowmeter; a second intake air amount calculation process (P5; P5*; P30) for calculating a second intake air amount (MC2; MC2*; MCSM), which serves as a calculated value of an intake air amount of the engine, based on any one of a detected value of an intake pipe pressure and a throttle opening degree instead of the detected value of the intake air flow rate; a determination process (P6, P50) for determining whether intake pulsation in an intake passage of the engine is large by determining whether the pulsation is greater than or equal to a preset determination value (α); a difference amount calculation process (P7, P60) for, when determining in the determination process (P6, P50) that the intake pulsation is not large (S110: NO; S160: YES), calculating a difference amount of the second intake air amount (MC2; MC2*; MCSM) from the first intake air amount (MC1; MCAFM); a calculation mode switching process (P8; P42) for setting the first intake air amount (MC1; MCAFM) as an intake air amount calculated value (MC; MCADJ) of the engine when determining in the determination process (P6, P50) that the intake pulsation is not large (S110: NO; S160: YES), and setting a corrected second intake air amount (MC3; MCSM*), which is a sum of the second intake air amount (MC2; MC2*; MCSM) and the difference amount, as the intake air amount calculated value (MC; MCADJ) when determining in the determination process (P6, P50) that the intake pulsation is large (S110: YES); and setting the first intake air amount (MC1; MCAFM) as an intake air amount calculated value (MC; MCADJ) of the engine when determining in the determination process (P6, P50) that the intake pulsation is not large (S110: NO; S160: YES), and setting a corrected second intake air amount (MC3; MCSM*), which is a sum of the second intake air amount (MC2; MC2*; MCSM) and the difference amount, as the intake air amount calculated value (MC; MCADJ) when determining in the determination process (P6, P50) that the intake pulsation is large (S110: YES); and an injector driving process for performing a fuel injection control on an injector by determining a fuel injection amount (QINJ) based on the set intake air amount calculated value (MC,MCADJ), wherein the engine controller is further configured to perform learning of, in the difference amount calculation process, a difference amount learning value (DEV[i]), which is a learning value of the difference amount, for each of difference amount learning regions (R[i]) divided from one another in accordance with a rotation speed of the engine.