This is something I worked on developing in my 20s. For me, what worked was finding an "ethical role model" -- someone who acts ethically and has a good sense of right & wrong -- and trying to model my choices based on what I thought that person would choose. Sometimes this would literally involve asking them "what do you think I should do?" and sometimes I'd just try to infer.
My ethical role model was my younger brother, who is one of the best people I know, and is someone who always seemed to have a good sense of "you shouldn't do that" or "this is the right thing to do, even if it's hard".
I committed to evaluating my decisions based on "what would my brother think of this" and I'm very proud to say that now, in my early 30s, I consider myself to be a very ethical person who does the right thing most of the time, even when it's inconvenient, and even when it's hard. I definitely could not have said that about myself a decade ago.
No idea if that will work for others, but it definitely worked for me!
I will agree that this is generally a good way to go, although in my experience there have been quite a few individuals that I end up no longer admiring.