Step 1: Use the section formula for external division.
Given points,
\[
A(1,2,-1)
\]
and
\[
B(-1,0,1)
\]
Point \(P\) divides \(AB\) externally in the ratio
\[
1:2
\]
Using the external section formula,
\[
P\left(
\frac{m x_2-n x_1}{m-n},
\frac{m y_2-n y_1}{m-n},
\frac{m z_2-n z_1}{m-n}
\right)
\]
where
\[
m=1,\qquad n=2
\]
Substituting the coordinates,
\[
x=\frac{1(-1)-2(1)}{1-2}
\]
\[
x=\frac{-1-2}{-1}=3
\]
Similarly,
\[
y=\frac{1(0)-2(2)}{1-2}
\]
\[
y=\frac{-4}{-1}=4
\]
Again,
\[
z=\frac{1(1)-2(-1)}{1-2}
\]
\[
z=\frac{1+2}{-1}=-3
\]
Hence,
\[
P=(3,4,-3)
\]
Step 2: Write the coordinates of \(Q\).
Given,
\[
Q=(1,3,-1)
\]
Step 3: Apply the distance formula.
Distance between
\[
P(3,4,-3)
\]
and
\[
Q(1,3,-1)
\]
is
\[
PQ=
\sqrt{
(3-1)^2+(4-3)^2+(-3+1)^2
}
\]
\[
=
\sqrt{
2^2+1^2+(-2)^2
}
\]
\[
=
\sqrt{4+1+4}
\]
\[
=
\sqrt{9}
\]
\[
=3
\]
Step 4: Final conclusion.
Therefore,
\[
\boxed{3}
\]