I occasionally find that I want to apply a K-S test in the context of unit-testing software that involves random behaviors. Unit testing with sampling statistics is a bit tricky because you want to minimize false-failures.

Extreme value distributions seem like one useful approach, since they make it possible to run a series of experiments, find a maximum D statisic between experimental results and an expected distribution, and measure the probability that D is an outlier using Extreme Value theory.

The idea is that I might run (n) K-S tests, comparing n pairs of samples. This will result in n D-statistic values; the maximum of these values will adhere to some variation of extreme value distribution. I could use the formula for this (or an approximation).

I have never found an extreme value distribution for the K-S D statistic. I suspect it at least adheres to the Weibull form of the EV distribution since its value has a finite maximum, but not even sure of that. I might do some empirical fitting but a more general formula would be even nicer.

UPDATE: Although I have posted an answer that works for a given sample size, it would also be interesting to derive a limiting cdf, that is identify $\alpha$ for the Weibull family of EVD: $$ F(x) = e^{-(-(\frac{x - \mu}{\sigma}))^\alpha} $$