A controller for an internal combustion engine, the controller being configured to control an internal combustion engine that is mounted on a vehicle and includes a filter configured to trap particulate matter in exhaust gas discharged from a plurality of cylinders and fuel injection valves provided for the respective cylinders (#1-#4), the controller being configured to execute, on condition that an execution request for a regeneration process of the filter is made: a dither control process of operating the fuel injection valves such that at least one of the cylinders (#1-#4) is a lean combustion cylinder, in which an air-fuel ratio is leaner than a stoichiometric air-fuel ratio, and at least another one of the cylinders (#1-#4) is a rich combustion cylinder, in which an air-fuel ratio is richer than the stoichiometric air-fuel ratio; and a deposition amount calculating process of calculating a deposition amount, which is an amount of particulate matter trapped by the filter wherein: the controller is configured to determine whether a target value of an average value of an exhaust air-fuel ratio in a predetermined period by the dither control process is leaner than the stoichiometric air-fuel ratio; and when it is determined that the target value is leaner than the stoichiometric air-fuel ratio and the temperature of the filter is higher than or equal to a prescribed temperature, the deposition amount calculating process successively calculates a decrease amount per unit time of the deposition amount, characterised in that, as compared to a case in which the target value of an average value is a first air-fuel ratio, a decrease amount per unit time of the deposition amount is calculated by the deposition amount calculating process to be a greater value in a case in which the target value is a second air-fuel ratio, which is leaner than the first air-fuel ratio. a dither control process of operating the fuel injection valves such that at least one of the cylinders (#1-#4) is a lean combustion cylinder, in which an air-fuel ratio is leaner than a stoichiometric air-fuel ratio, and at least another one of the cylinders (#1-#4) is a rich combustion cylinder, in which an air-fuel ratio is richer than the stoichiometric air-fuel ratio; and a deposition amount calculating process of calculating a deposition amount, which is an amount of particulate matter trapped by the filter wherein: the controller is configured to determine whether a target value of an average value of an exhaust air-fuel ratio in a predetermined period by the dither control process is leaner than the stoichiometric air-fuel ratio; and when it is determined that the target value is leaner than the stoichiometric air-fuel ratio and the temperature of the filter is higher than or equal to a prescribed temperature, the deposition amount calculating process successively calculates a decrease amount per unit time of the deposition amount, characterised in that, as compared to a case in which the target value of an average value is a first air-fuel ratio, a decrease amount per unit time of the deposition amount is calculated by the deposition amount calculating process to be a greater value in a case in which the target value is a second air-fuel ratio, which is leaner than the first air-fuel ratio. the controller is configured to determine whether a target value of an average value of an exhaust air-fuel ratio in a predetermined period by the dither control process is leaner than the stoichiometric air-fuel ratio; and when it is determined that the target value is leaner than the stoichiometric air-fuel ratio and the temperature of the filter is higher than or equal to a prescribed temperature, the deposition amount calculating process successively calculates a decrease amount per unit time of the deposition amount, characterised in that, as compared to a case in which the target value of an average value is a first air-fuel ratio, a decrease amount per unit time of the deposition amount is calculated by the deposition amount calculating process to be a greater value in a case in which the target value is a second air-fuel ratio, which is leaner than the first air-fuel ratio.