A burnt offering may be accepted from a gentile even if he is an idolater. However, if a Jew becomes an apostate and worships idols or publicly violates the Sabbath then no sacrifice can be accepted from him. This excludes an apostate or one who publicly violates the Sabbath. However, if a person is wicked because of other sins but does not violate the Sabbath and does not worship idols, then if he wishes to bring a sacrifice because of some sin he has committed, this sacrifice may be accepted. Perhaps through the sacrifice, his heart will be turned to good and he will repent and change his ways.
People can have all kinds of motives for bringing a sacrifice.
A person might bring a sacrifice to show off. He may want to show that he is a good Jew and make a show of repenting. In his heart, however, he may remain wicked and sinful. From his sacrifice alone one could determine whether the person were wicked or not. If he were wicked, the smoke of his sacrifice would rise crookedly.