6. In $\triangle A B C$, $\angle A$ and $\angle B$ are both acute angles, and $C D$ is the altitude. Given that $\frac{A D}{D B}=\left(\frac{A C}{B C}\right)^{2}$. Then $\triangle A B C$ is ( ).
(A) a right triangle
(B) an isosceles triangle
(C) an isosceles right triangle
(D) an isosceles triangle or a right triangle
6. (D).

As shown in Figure 5, let $A D=a, D B=b$. According to the given, let $A C=\sqrt{a x}$, then $B C=\sqrt{b x}$.

Since $A C^{2}-A D^{2}=C D^{2}=B C^{2}-D B^{2}$, we have
$$
a x-a^{2}=b x-b^{2},
$$

which simplifies to
$$
(a-b)[x-(a+b)]=0.
$$
When $a=b$, it is easy to see that
$$
\triangle A D C \cong \triangle B D C \Rightarrow A C=B C \text {; }
$$

When $x=a+b$,
$$
A C^{2}+B C^{2}=a x+b x=(a+b)^{2}=A B^{2} \text {. }
$$