6. If the positive integer $m$ makes the maximum value of the function $y=x+\sqrt{13-2 m x}(x \geqslant 0)$ also a positive integer, then this maximum value equals ( ).
(A)3
(B) 4
(C) 7
(D) 8
6.C.

Let $t=\sqrt{13-2 m x}(t \geqslant 0)$, then $x=\frac{13-t^{2}}{2 m}$. Therefore,
$$
y=\frac{13-t^{2}}{2 m}+t=-\frac{1}{2 m}(t-m)^{2}+\frac{m^{2}+13}{2 m} \text {. }
$$

Since $t \geqslant 0$ and $m$ is a positive integer, when $t=m$, $y$ reaches its maximum value, and the maximum value is $\frac{m^{2}+13}{2 m}$.
To make $\frac{m^{2}+13}{2 m}$ a positive integer, then $m$ must be an odd number.
Also, $\frac{m^{2}+13}{2 m}=\frac{1}{2}\left(m+\frac{13}{m}\right)$, so $m+\frac{13}{m}$ should be an even number. Therefore, $m$ can only be 1 or 13. Thus, the maximum value of $y$ is 7.