It only considers valid chains. If either chain has an invalid block in it, it is excluded from consideration.
If the chainwork (sum of the inverses of the targets of the blocks in the chain, approximately proportional to the sum of the difficulties) differs, chains with less than the maximum chainwork are excluded from consideration.
If there are still ...
The SHA256 hash algorithm produces what looks exactly like a random number in the range 0 to 2256-1 (1.1579208923731619542357098500869e+77). Each of those values should be equally likely.
So if you produce a large number of these by altering the data to be hashed, you cannot steer the results and most of the results will be a large number.
Some of the ...
Bitcoin difficulty is not determined by the "number of zeros", but none the less the Bitcoin genesis block would satisfy a difficulty target substantially higher than might be expected. This doesn't really mean anything in the scheme of how the system operates, it's just a curiosity.