Solution:
If k=⌊3N⌋, then the maximum possible probability is (3k)(3k−1)(3k−2)6k3, with equality when there are k balls of each of the three colors.
Going from 3k→3k+1 replaces 3k−2k→3k+1k+1, which is smaller, and going from 3k+1→3k+2 replaces 3k−1k→3k+2k+1, which is again smaller.
For this to be larger than 10023, we find we need 0>7k2−207k+46, and so k=29 is the maximal value.