Step 1: The quantity we want to maximise.
Magnetic moment is $M=NIA$, where $N$ is the number of turns and $A$ is the area enclosed by one turn. The wire length $L$ and current $I$ are fixed.
Step 2: Tie the turns to the fixed length.
If the same wire is wound into $N$ circular turns of radius $r$, the total length used is \[ L=N(2\pi r),\quad\text{so}\quad r=\frac{L}{2\pi N}. \]
Step 3: Area of one turn.
\[ A=\pi r^2=\pi\left(\frac{L}{2\pi N}\right)^2=\frac{L^2}{4\pi N^2}. \]
Step 4: Plug into the magnetic moment.
\[ M=N I A=N I\cdot\frac{L^2}{4\pi N^2}=\frac{I L^2}{4\pi N}. \]
Step 5: See how $M$ depends on $N$.
Since $M\propto\dfrac{1}{N}$, the moment shrinks as the number of turns rises. So fewer turns give more moment.
Step 6: Pick the smallest possible $N$.
The least number of turns you can make is one. So a single loop gives the largest magnetic moment.
\[ \boxed{N=1} \]