Let $R$ be a commutative ring with identity and $S$ a multiplicatively closed subset of $R$. This paper aims to introduce the concept of $S-n$-ideals as a generalization of $n$-ideals. An ideal $I$ of $R$ disjoint with $S$ is called an $S-n$- ideal if there exists $s\in S$ such that whenever $ab \in I$ for $a,~b\in R,$ then $sa\in \sqrt{0}$ or $sb\in I$. The relationships among $S-n$-ideals, $n$-ideals, $S$-prime and
$S$-primary ideals are clarified. Besides several properties, characterizations and examples of this concept, S-n-ideals under various contexts of constructions including direct products, localizations and homomorphic images are given. For some particular $S$ and $m\in N$, all $S-n$-ideals of the ring $Z_{m}$ are completely determined. Furthermore, $S-n$-ideals of the idealization ring and amalgamated
algebra are investigated.