If ${\mathcal O}_K/{\mathfrak p}^r$ has characteristic $p$ then ${\mathfrak p}^r|p{\mathcal O}_K$, so $r \leq e({\mathfrak p}|p)$. In particular, if ${\mathfrak p}$ is unramified then you can't use it to produce the examples you seek with $n > 1$.

Let $K/{\mathbf Q}$ have degree $n$ and be totally ramified at a prime $p$. (Example: $K = {\mathbf Q}(\sqrt[n]{p})$, or more generally $K = {\mathbf Q}(\alpha)$ where $\alpha$ is the root of any monic in ${\mathbf Z}[x]$ which is Eisenstein at $p$.) Then $p{\mathcal O}_K = {\mathfrak p}^n$. We'll show ${\mathcal O}_K/(p) \cong {\mathbf F}_p[x]/(x^n)$. The quotient ring ${\mathcal O}_K/{\mathfrak p}^r$ for any $r$ is unchanged if we pass to the completion: ${\mathcal O}_K/{\mathfrak p}^r \cong {\widehat{\mathcal O}}/(\pi)^r$, where the $\widehat{\mathcal O}$ denotes the ${\mathfrak p}$-adic completion of ${\mathcal O}_K$ and $\pi$ generates the maximal ideal of $\widehat{\mathcal O}$.

The ${\mathfrak p}$-adic completion $K_{\mathfrak p}$ is a totally ramified extension of ${\mathbf Q}_p$ with degree $n$, so its ring of integers, which is $\widehat{\mathcal O}$, has the form ${\mathbf Z}_p[\pi]$. (The chapter on completions in Lang's Algebraic Number Theory has a theorem that the integers in any finite extension $F$ of ${\mathbf Q}_p$ has the form ${\mathbf Z}_p[\alpha]$ and if you look carefully at the proof then you see that in the totally ramified case you can take as $\alpha$ any generator of the maximal ideal of the integers of $F$.) Therefore ${\mathcal O}_K/{\mathfrak p}^r \cong {\mathbf Z}_p[\pi]/(\pi^r)$ for any $r$.

When $r \leq n$, the ring ${\mathbf Z}_p[\pi]/(\pi^r)$ has characteristic $p$, so there is a surjective ring homomorphism ${\mathbf F}_p[x] \rightarrow {\mathbf Z}_p[\pi]/(\pi^r)$ by sending $x$ to $\pi \bmod \pi^r$. The map kills $x^r$, so we get a surjective ring homomorphism ${\mathbf F}_p[x]/(x^r) \rightarrow {\mathbf Z}_p[\pi]/(\pi^r)$. It is left to the reader to check ${\mathbf Z}_p[\pi]/(\pi^r)$ has size $p^r$, so we have an isomorphism.

To realize $k[x]/(x^n)$ for finite fields $k$ of non-prime size, pick your favorite number field $F$ whose ring of integers has a prime ideal at which the residue field is isomorphic to $k$ (example: given any prime power $q = p^f$, the number field ${\mathbf Q}(\zeta_{q-1})$ at any prime lying over $p$ has a residue field of order $q$). Then let $E$ be any totally ramified extension of $F$ with degree $n$, e.g., the extension obtained by adjoining to $F$ the root of a monic of degree $n$ in ${\mathcal O}_F[X]$ which is Eisenstein at the prime whose residue field is isomorphic to $k$. Letting ${\mathfrak p}$ denote the prime in $E$ that lies over your chosen prime in $F$, an argument like the one above that works with $F$ and its completions as base field instead of ${\mathbf Q}$ and ${\mathbf Q}_p$ implies ${\mathcal O}_E/{\mathfrak p}^n \cong k[x]/(x^n)$.

When $q$ is a power of $p$, the prime $p$ is unramified in ${\mathbf Q}(\zeta_{q-1})$, so the polynomial $X^n - p$ is Eisenstein at any prime lying over $p$ in ${\mathbf Q}(\zeta_{q-1})$. Therefore we can use the number field $E := {\mathbf Q}(\zeta_{q-1},\sqrt[n]{p})$ to generate the desired example: if ${\mathfrak p}$ is any prime which lies over $p$ in ${\mathcal O}_E$ then ${\mathcal O}_E/{\mathfrak p}^n \cong {\mathbf F}_q[x]/(x^n)$.

The ring of integers of $E$ may be more than ${\mathbf Z}[\zeta_{q-1},\sqrt[n]{p}]$, so this is a situation where working in a ${\mathfrak p}$-adic completion (which has isomorphic quotient rings as the ring of integers for ideals that are powers of that prime) makes life easier.

[Edit: As someone pointed out to me by email, there is an obvious obstruction to realizing general finite commutative rings as quotient rings of integers of number fields: the local factors of the quotient of a ring of integers of a number field by a nonzero ideal are quotients of a DVR, hence the local factors have principal maximal ideals (and finite residue field). So one never gets, for example, the finite ring ${\mathbf F}_p[x,y]/(x,y)^2$ as the quotient ring of a ring of integers.

Moreover, that obstruction is the only one. That is, a finite commutative ring is isomorphic to the quotient ring of the integers of some number field iff its local factors have principal maximal ideals. I showed above how to realize any finite local ring of the form $k[x]/(x^n)$ using suitable $p$-adic fields and one can show more generally that any finite local commutative ring is a quotient ring of the integers of some $p$-adic field. Then
it remains to put together a product of such finite rings. If $K_1,...,K_n$ are non-archimedean local fields then by weak approximation (treating together the places over a common rational prime, etc.) there exists a number field $F$ with pairwise distinct places $v_1,...,v_n$ such that $K_i = F_{v_i}$, so every finite quotient of ${\mathcal O}_{K_i}$ at powers of primes corresponding to $v_i$ is a finite quotient of ${\mathcal O}_F$ and any finite product of such quotients is a finite quotient of ${\mathcal O}_F$ by the Chinese Remainder Theorem.]

lotclearer in this question. – KConrad Aug 6 '11 at 11:37