We study the WKB analysis of the solutions to the linear problem for a modified affine Toda field equation, which is equivalent to the higher-order ordinary differential equation (ODE) studied in the ODE/IM correspondence. After gauge transformation, we diagonalize the flat connection of the linear problem to reduce the latter to a set of independent first-order linear differential equations. We explicitly perform this procedure for classical affine Lie algebras with lower ranks. In particular, we study the WKB solutions of the $$ {D}_r^{(1)} $$
D
r
1
- and $$ {D}_{r+1}^{(2)} $$
D
r
+
1
2
-type linear problems, which correspond to the higher-order ODEs with the pseudo-differential operator. The diagonalized connection is obtained from the Riccati equations of the adjoint linear problem and related to the conserved currents of the integrable hierarchy constructed by Drinfeld and Sokolov up to total derivatives.