I am not entirely sure about this, but I think they way they do it is they add in an "average hitting performance by pitchers" to however many AB you need to get to 50.
So a pitcher who went 1 for 2 would end up looking pretty terrible (average hitting performance by pitchers is very poor), but a pitcher who had 49AB and good stats would in fact hit pretty well.
Again, I am not sure about this, so apologies in advance if this is in fact incorrect.