A US judge has dismissed Blake Lively's sexual harassment claims in her lawsuit against co-star Justin Baldoni.