Let $P\in \mathrm{GL}_n(\mathbb{Q})$ be positive definite, and $(\det P)^{\frac{1}{n}}\in \mathbb{Q}$.

**Question**. Can one always write $P=(\det P)^{\frac{1}{n}} AA^*$, with $A\in \mathrm{SL}_n(\mathbb{Q}[i])$ ?

Note that  $P$ cannot always be written as $P=AA^*$, with
$A\in \mathrm{GL}_n(\mathbb{Q}[i])$. Indeed, this would imply
$\det P=a\overline{a}$, where $a=\det A$, but $\det P$ is not always a sum of two rational squares.

As well, note that $P$ can always be diagonalised, as $P=LDL^\top$, with $L,D\in \mathrm{GL}_n(\mathbb{Q})$, and $L$ lower trianglular with 1s on the main diagonal,  $D$ diagonal. Thus $P$ can be assumed to be diagonal.
 

Probably, we cannot always take $A\in \mathrm{GL}_n(\mathbb{Q})$,
as the diagonal entries of $P$ are sums  of $n$ squared norms of entries of $A$, and this would not always work for $n=2$ if all the entries of $A$ are in $\mathbb{Q}$.



I don't even know the answer for $n=2$. On the other hand, one can e.g. have

$$
P=\begin{pmatrix}
2 & 0 \\
0 & 8
\end{pmatrix}
=
4AA^*,
\quad 
A=\begin{pmatrix}\frac{1}{2}&\frac{1}{2}\\-1&1\end{pmatrix}.
$$

-------------
A less trivial example, which also shows that the conditions on $A$ and $P$ may be weakened:

$$
P=\begin{pmatrix}
7 & 0 \\
0 & 7/2
\end{pmatrix}
=
AA^*, \quad 
A=\begin{pmatrix}
2+i&1+i\\
1&-\frac{3+i}{2}
\end{pmatrix}.
$$
Here $(\det P)^\frac{1}{2}=\frac{7}{\sqrt{2}}\not\in\mathbb{Q}$.
 
Thus, in general, let's consider the decomposition $\det P=\zeta_P\sigma_P$, where $\sigma_P$ the "biggest" part of $\det P$ representable as a norm in $\mathbb{Q}[i]$ (in the latter example  $\sigma_P=1/2$, $\zeta_P=7^2$). Thus the modified question is as follows.

**Question′**. $P\in \mathrm{GL}_n(\mathbb{Q})$ be positive definite, and satisfying $\zeta_P^{\frac{1}{n}}\in \mathbb{Q}$. Can one always write $P=AA^*$, with $A\in \mathrm{GL}_n(\mathbb{Q}[i])$ ?