For a polynomial $P$ and a positive integer $n$, define $P_n$ as the number of positive integer pairs $(a,b)$ such that $a<b \leq n$ and $|P(a)|-|P(b)|$ is divisible by $n$. Determine all polynomial $P$ with integer coefficients such that $P_n \leq 2021$ for all positive integers $n$.
1. **Assume a Positive Leading Coefficient**: 
   Since \( P \) is a polynomial with integer coefficients, we can assume without loss of generality that \( P \) has a positive leading coefficient. This implies that there exists some positive integer \( k \) such that \( P(x) > 0 \) for all \( x > k \).

2. **Define \( Q_n \)**:
   For any \( n \in \mathbb{N} \), let \( Q_n \) be the number of integer pairs \( (a, b) \) such that \( k < a < b \leq n \) and \( n \mid P(a) - P(b) \). Clearly, \( Q_n \leq P_n \leq 2021 \) for all positive integers \( n \).

3. **Claim 1: \( P \) Hits All Residues Modulo \( m \)**:
   - **Proof**: Assume for the sake of contradiction that \( P \) does not hit some residue modulo \( m \) for some \( m > 1 \). Then for any \( d > 0 \), if we let \( n = dm \), \( P \) does not hit at least \( d \) residues modulo \( n \).
   - For \( 0 \leq i < n \), let \( a_i \) denote the number of integers in the interval \( (k, n] \) satisfying the congruence \( P(x) \equiv i \pmod{n} \). Then, at most \( n - d \) of the \( a_i \) are non-zero.
   - Using the binomial coefficient and the AM-GM inequality, we have:
     \[
     2021 \geq Q_n = \sum_{i=0}^{n-1} \binom{a_i}{2} \geq (n-d) \binom{\frac{a_0 + a_1 + \cdots + a_{n-1}}{n-d}}{2} = (n-d) \binom{\frac{n-k}{n-d}}{2}
     \]
   - Putting \( n = dm \) and expanding, we get:
     \[
     4042d(m-1) \geq (dm-k)(d-k)
     \]
   - This inequality cannot hold for sufficiently large \( d \) because the left-hand side (LHS) is linear while the right-hand side (RHS) is quadratic. Hence, \( P \) must hit all residues modulo \( m \) for every \( m > 1 \).

4. **Distinct Residues Modulo \( m \)**:
   - In particular, \( P(0), P(1), \dots, P(m-1) \) are distinct modulo \( m \) for all \( m > 1 \). Let \( P(0) = c \), and define \( Q(x) = P(x) - c \). Then \( m \mid Q(x) \implies m \mid x \) for all \( m > 1 \) and \( x \in \mathbb{Z} \).

5. **Form of \( Q(x) \)**:
   - Note that \( Q(0) = 0 \), but \( Q \) is not identically zero because \( P \) is non-constant. In fact, \( Q \) has a positive leading coefficient because of our initial assumption. Let \( Q(x) = x^l R(x) \) for some \( l > 0 \) where \( R(0) \neq 0 \).

6. **Schur's Theorem Application**:
   - If \( R \) is non-constant, then by Schur's theorem, there exists a large prime \( p > |R(0)| \) such that \( p \mid R(x) \) for some integer \( x \). But this means \( p \nmid R(0) \implies p \nmid x \), while \( p \mid x^l R(x) \), which is a contradiction. Therefore, \( R \) must be constant, say \( d > 0 \).

7. **Form of \( P(x) \)**:
   - If \( d > 1 \) or \( l > 1 \), then we can choose \( x = 2 \) and \( m = d2^l > 2 \) to get \( m \mid Q(2) \) but \( m \nmid 2 \), which is a contradiction. Therefore, \( Q(x) = x \) and \( P(x) = x + c \).

8. **Narrowing Down \( c \)**:
   - Clearly, \( c \geq 0 \) works, so assume \( c < 0 \); let \( -c = d > 0 \). Then \( |P(x)| = d - x \) for \( 1 \leq x \leq d \), and \( |P(x)| = x - d \) otherwise. This implies \( |P(a)| - |P(b)| = \pm (a - b) \) or \( \pm (a + b - 2d) \).
   - If \( 0 < a < b \leq n \) and \( n \mid |P(a)| - |P(b)| \), then we must have \( |P(a)| - |P(b)| = \pm (a + b - 2d) \), so \( a, b \) lie on different sides of \( d \): \( b > d \geq a \). So if \( n \leq d \), \( P_n = 0 \). Else we have:
     \[
     -n < -d < a + b - 2d \leq n - d < n
     \]
   - So if \( n \mid \pm (a + b - 2d) \), we must have \( a + b = 2d \). For \( n < 2d \), this has precisely \( n - d \leq d - 1 \) solutions, and for \( n \geq 2d \), it has precisely \( d - 1 \) solutions. Therefore, we must have \( d - 1 \leq 2021 \implies d \leq 2022 \).

Conclusion:
The solutions are:
\[
\boxed{P(x) = \pm (x + c)}
\]
where \( c \geq -2022 \) is any integer.