We report on the automatic alignment of a transmission electron microscope equipped with an orbital angular momentum sorter using a convolutional neural network. The neural network is able to control all relevant parameters of both the electron-optical setup of the microscope and the external voltage source of the sorter without input from the user. It can compensate for mechanical and optical misalignments of the sorter, in order to optimize its spectral resolution. The alignment is completed over a few frames and can be kept stable by making use of the fast fitting time of the neural network.