Here is a little data (not an answer) for small arrays for anyone who wants to compare against a theoretical
calculation.
I looked at square $n \times n$ arrays, $k=2$ colors only. Here are the counts for $P$,
after $100$ random trials:
$$
(2, 2.4), (3, 24.2), (4, 95.5), (5, 260.3), (6, 575.0), (7, 1100.1), (8, 1919.0)
$$
In other words, just to interpret the last piece of data: In random $8 \times 8$ arrays, of
the $\binom{64}{2}=2016$ pairs, there were on average $T=97.0$ distinct distance/color pairs
(using Gerhard's definition for types $T$),
leaving $P=1919.0$ repeated pairs; note $T+P=2016$.
(In one trial, the distance $\sqrt{65}$ and colors $(2,2)$ occurred only once,
whereas the distance $\sqrt{41}$ and colors $(1,2)$ occurred $25$ times.)
Here is a graph of the same data:

Added. Now that the OP has indicated an interest in variation with the number of
colors $k$, here is the same type of data, but for $k=2,3,4,5,6$:


