Let us show a more general statement, and then show how it implies your question: given distinct positive squarefree numbers $n_1, n_2, \dots, n_k$, the numbers $\sqrt{n_1}, \dots, \sqrt{n_k}$ are linearly independent over $\mathbb{Q}$.
Proof: Suppose that $$\sum_{i = 1}^{k} a_i \sqrt{n_i} = 0$$ where without loss of generality, $a_1 \neq 0$. Dividing by $\sqrt{n_1}$ we get $$a_1 + \sum_{i = 2}^{k} a_i \sqrt{\frac{n_i}{n_1}} = 0$$ Take the trace of this algebraic number with respect to the field extension $\mathbb{Q} \left( \sqrt{\frac{n_2}{n_1}}, \dots, \sqrt{\frac{n_k}{n_1}} \right) / \mathbb{Q}$. On the one hand, it should be 0. On the other hand, for all $i \neq 1$, the trace of $\sqrt{\frac{n_i}{n_1}}$ is 0 as it as a multiple of the trace of this number with respect to the field extension $\mathbb{Q} \left( \sqrt{\frac{n_i}{n_1}} \right) / \mathbb{Q}$, and of course the trace of $a_1$ is some nonzero multiple of $a_1$, which is a contradiction.
In fact, I believe that this argument works even if we take $\sqrt[m_i]{n_i}$, where $m_i \geq 2$ are some positive integers.
Now to the question: for $1 \leq i \leq k$ write $n_i = r_i s_{i}^2$ where $r_i$ is squarefree. Then we have $$\sum_{i = 1}^{k} \sqrt{n_i} = \sum_{i = 1}^{k} s_i \sqrt{r_i}$$ Combining terms with the same $r_i$, if not all $n_i$'s are perfect squares (that is equivalently, some $r_i$ is nonzeroexceeds $1$), then if this number is rational then we have a nontrivial linear combination of $1$ and some square roots of distinct squarefree positive integers, which as we showed above is a contradiction.