\[ \boxed { \left ( {\frac {\rm d}{{\rm d}x}}y \left ( x \right ) \right ) ^{n}- \left ( f \left ( x \right ) \right ) ^{n} \left ( y \left ( x \right ) -a \right ) ^{n+1} \left ( y \left ( x \right ) -b \right ) ^{n-1}=0} \]
Mathematica: cpu = 0.381048 (sec), leaf count = 84 \[ \left \{\left \{y(x)\to \frac {-a (a-b)^n \left (\int _1^x (-1)^{\frac {1}{n}+1} f(K[1]) \, dK[1]+c_1\right ){}^n-b n^n}{-(a-b)^n \left (\int _1^x (-1)^{\frac {1}{n}+1} f(K[1]) \, dK[1]+c_1\right ){}^n-n^n}\right \}\right \} \]
Maple: cpu = 0.297 (sec), leaf count = 127 \[ \left \{ y \left ( x \right ) =-{a \left ( {\frac {n}{-{\it \_C1}\,a+{ \it \_C1}\,b-a\int \!f \left ( x \right ) \,{\rm d}x+b\int \!f \left ( x \right ) \,{\rm d}x}} \right ) ^{n} \left ( -1+ \left ( {\frac {n}{-{\it \_C1}\,a+{\it \_C1}\,b-a\int \!f \left ( x \right ) \,{\rm d}x+b\int \!f \left ( x \right ) \,{\rm d}x}} \right ) ^{n} \right ) ^{-1}}+{b \left ( { \frac {n}{-{\it \_C1}\,a+{\it \_C1}\,b-a\int \!f \left ( x \right ) \,{\rm d}x+b\int \!f \left ( x \right ) \,{\rm d}x}} \right ) ^{n} \left ( -1+ \left ( {\frac {n}{-{\it \_C1}\,a+{\it \_C1}\,b-a\int \!f \left ( x \right ) \,{\rm d}x+b\int \!f \left ( x \right ) \,{\rm d}x}} \right ) ^{n} \right ) ^{-1}}+a \right \} \]