Answer
$y(x)=\left[\left(\frac{x-a}{2}+\frac{a-b}{2}\ln{|x-a|}+C\right)\left(\frac{x-a}{x-b}\right)\right]^2$
Work Step by Step
Given
$$(x-a)(x-b)(y'-\sqrt{y})=2(b-a)y$$
where $a$ and $b$ are constants, rewrite the equation in Bernoulli form: $\frac{dy}{dx}+P(x)y=Q(x)y^n$
$$y'-\sqrt{y}=\frac{2(b-a)}{(x-a)(x-b)}y$$
$$y'-\frac{2(b-a)}{(x-a)(x-b)}y=\sqrt{y}$$
$$\frac{dy}{dx}+\frac{2(a-b)}{(x-a)(x-b)}y=y^{\frac{1}{2}}$$
Divide all terms by $y^{\frac{1}{2}}$:
$$y^{-\frac{1}{2}}\frac{dy}{dx}+\frac{2(a-b)}{(x-a)(x-b)}y^{\frac{1}{2}}=1$$
Let $u=y^{\frac{1}{2}}$, thus $\frac{1}{1-\frac{1}{2}}(\frac{du}{dx})=y^{-\frac{1}{2}}\frac{dy}{dx}$
$$\frac{1}{1-\frac{1}{2}}\left(\frac{du}{dx}\right)+\frac{2(a-b)}{(x-a)(x-b)}u=1$$
$$\frac{du}{dx}+\frac{(a-b)}{(x-a)(x-b)}u=\frac{1}{2}$$
Now solve as a first-order linear differential equation of the form $\frac{dy}{dx}+P(x)y=Q(x)$.
First, find the integration factor $I(x)=e^{\int{P(x)}dx}$:
$$I(x)=e^{\int{\frac{(a-b)}{(x-a)(x-b)}}dx}=e^{\int{\frac{1}{x-b}-\frac{1}{x-a}}dx}=e^{\ln{|x-b|}-\ln{|x-a|}}=e^{\ln{|\frac{x-b}{x-a}|}}=\frac{x-b}{x-a}$$
Multiply both sides by $I(x)$ and replace left side with $\frac{d}{dx}[(\frac{x-b}{x-a})u]$:
$$\frac{d}{dx}\left[\left(\frac{x-b}{x-a}\right)u\right]=\frac{1}{2}\left(\frac{x-b}{x-a}\right)$$
Integrate both sides:
$$\int{\frac{d}{dx}\left[\left(\frac{x-b}{x-a}\right)u\right]}=\int{\frac{1}{2}\left(\frac{x-b}{x-a}\right)}dx$$
$$\left(\frac{x-b}{x-a}\right)u=\frac{1}{2}\int{\frac{x}{x-a}}dx-\frac{1}{2}\int{\frac{b}{x-a}}dx$$
The first integral on the right side can be solved with $v$-substitution, where $v=x-a$:
$$\frac{1}{2}\int{\frac{x}{x-a}}dx=\frac{1}{2}\int{\frac{v+a}{v}}du=\frac{1}{2}\int{1+\frac{a}{v}}du=\frac{1}{2}(v+a\ln{|v|})=\frac{1}{2}[(x-a)+a\ln{|x-a|}]$$
The second integral on the right side can be solved:
$$-\frac{1}{2}\int{\frac{b}{x-a}}dx=-\frac{b}{2}\int{\frac{1}{x-a}}dx=-\frac{b}{2}\ln{|x-a|}$$
Thus, going back to our initial equation:
$$\left(\frac{x-b}{x-a}\right)u=\frac{1}{2}[(x-a)+a\ln{|x-a|}]-\frac{b}{2}\ln{|x-a|}+C$$
$$\left(\frac{x-b}{x-a}\right)u=\frac{x-a}{2}+\frac{a-b}{2}\ln{|x-a|}+C$$
Solve for $y$:
$$\left(\frac{x-b}{x-a}\right)y^{\frac{1}{2}}=\frac{x-a}{2}+\frac{a-b}{2}\ln{|x-a|}+C$$
$$y^{\frac{1}{2}}=\left(\frac{x-a}{2}+\frac{a-b}{2}\ln{|x-a|}+C\right)\left(\frac{x-a}{x-b}\right)$$
$$y=\left[\left(\frac{x-a}{2}+\frac{a-b}{2}\ln{|x-a|}+C\right)\left(\frac{x-a}{x-b}\right)\right]^2$$