What follows is more a series of considerations than a practical algorithm, but could still be of interest. The main idea is that it's easier to work with one-variable polynoms, so we trade a bad problem in two variables for several bad problems in one variable.
The key point is the following lemma (assume $k$ is of characteristic zero!): if $P(X,Y)$ is a two-variable polynom and there are enough distinct values of $a$ such that $P(X,a)$ is a constant polynomial, then $P(X,Y)$ is a polynom in $Y$ only. The proof is by arguing that $P(X,a)$ being a constant polynom means that $a$ is a root for the polynom (in $Y$) coefficient of $X^n$ for all $n>0$. And that can't happen too often in characteristic zero, unless those coefficients are zero polynoms, hence $P(X,Y)$ is reduced to its constant term as a polynom in $X$, hence is only a polynom in $Y$, as was to be proved.
Now, for your question : if you suppose a $P(X,Y)$ isn't irreducible, say factors as $Q(X,Y)R(X,Y)$, but many $P(X,a)$ are irreductible, then that means for each such $a$ either $Q(X,a)$ or $R(X,a)$ is a constant, hence given enough of those $a$, one of $Q$ or $R$ at least is only a polynom in $Y$ by the lemma, say $R$.
Then if you manage to fully factor $P(a,Y)=Q(a,Y)R(Y)$ for some $a$ (again dropping to a one-variable polynom), you get a list with $R$ (and divisors of $R$): check each element for divisibility of $P(X,Y)$. If none is good, $P$ is irreducible.
- In fact, after you have found $R$ is a polynom in $Y$, just consider the gcd of the coefficients of the $X^n$ -- if you get $1$, $P$ is irreducible.
- The previous considerations mostly prove that a cheating polynom (ie: not irreducible although it appears to be when evaluated along a variable) necessarily has a very precise form, which makes it susceptible to easy factorisation.