  The open spin-1/2 XXZ spin chain with diagonal boundary magnetic fields is
the paradigmatic example of a quantum integrable model with open boundary
conditions. We formulate a quantum algorithm for preparing Bethe states of this
model, corresponding to real solutions of the Bethe equations. The algorithm is
probabilistic, with a success probability that decreases with the number of
down spins. For a Bethe state of $L$ spins with $M$ down spins, which contains
a total of $\binom{L}{M}\, 2^{M}\, M!$ terms, the algorithm requires $L+M^2+2M$
qubits.
