I don't know how to tell a bad squash from a good squash just like pumpkins.
What kind of squash? Summer squash or winter? The best I can tell you now is it shouldn't have soft spots or mold. Personally I think finding a bad squash would be VERY unlikely. Winter squash stores for a long time if you want it to last try and get an unblemished specimen (no bruises or puncture marks), young tender summer squash doesn't last as long and will rot when it is no longer good which is quite obvious.