  In this paper, prime as well as primitive Kumjian-Pask algebras
$\mathrm{KP}_R(\Lambda)$ of a row-finite $k$-graph $\Lambda$ over a unital
commutative ring $R$ are completely characterized in graph-theoretic and
algebraic terms. By applying quotient $k$-graphs, these results describe prime
and primitive graded basic ideals of Kumjian-Pask algebras. In particular, when
$\Lambda$ is strongly aperiodic and $R$ is a field, all prime and primitive
ideals of a Kumjian-Pask algebra $\mathrm{KP}_R(\Lambda)$ are determined.
