To trust someone, you need to establish a basis for trust. That might be knowing about past work, questioning them about their ideology and morals and so on. There is no easy route to trust.
To trust their professional skills is no different. Have they done similar work? Who recommends them? How do they act online and in the real world? Do they exhibit qualities of trust everywhere? Do they have a track record?
But there is a slightly different question that would be a much better one for this forum.
"How can I trust code that a developer has written if I don't understand it?"
Again, there are no magic bullets but there are things you can do to reduce any risks:
- Do you trust the person? e.g. the first question. If they have a track record of trust, that's a good sign.
Make an attempt to understand the code - well written code will be modular and it should be relatively easy to understand when read, even by non-programmers - if it is important and you really have nobody available to make sense of it, get someone in.
Incidentally, if someone has written code for you and it is incomprehensible then there is a pretty good likelihood that they've done a bad job.
Use tools to analyse the code for common errors and flaws.
You should also be making sure that you specify the requirements correctly. If your spec to any programmer doesn't make clear what quality criteria you need - regarding security, readability and documentation for example - you only have yourself to blame if it all goes horribly wrong.