Talk to him about it. It will be an incredibly personal conversation, but if you want to try to build a relationship with him, it's very necessary.
You need to establish what the problem is. What's running through his mind when he loses his erection? It's the only way to find out if it's a medical problem or a mental one and regardless of the answer whether he's worth pursuing a relationship with.
If he's experiencing anxiety about performance based on previous relationships or anxiety, I'd be wary about allowing yourself to bond too much. Ideally, he should have dealt with that before allowing himself to get involved in a new relationship. However, you might want to allow for the fact that the latter stages of dealing with it may involve trying it out with a new person (i.e. you). If he seems otherwise ready for a relationship, is considerate and attentive during sex and isn't in any way trying to blame you or make you responsible (i.e. he isn't saying things like if you make him feel secure), you might like to give him the benefit of the doubt and look at solutions. If that's the stage he's at I would expect his recovery to be relatively swift.
If it's a medical problem, there are various solutions he can try, but that's for him to investigate and pursue, not you. If he's unwilling to do that, bear in mind that you will invariably find yourself cast in the role of 'fixer' for any relationship problems that pop up - not a role anyone should be willing to take on because what about when you are low and need someone to support you or take care of their own needs for a while.
Ultimately, he might not be able to solve this problem at all and if you want a relationship with him you may have to live with it. Many couples can get around the problem through non-penetrative sex, but if penetrative sex is really important to you, that won't work and you would be daft to continue the relationship knowing that simply because you don't want to feel like a bad person for ending it over ED. You wouldn't be ending it over ED BTW, you'd be ending it because of incompatibility - ED just happens to be the form it's taken.
Hope you find the right solution.