Maximum entropy principle in stochastic dynamics