The comparison is relative to ones perspective and beliefs. There is no one absolute way to compare the two. For instance, intentions are fundamentally important in Islam so in any comparison I would draw I would weigh in the intentions behind an action before declaring what type of person one is. I could also mistake in apparent judgement.
Is one who does service to humanity better or the one who does not do dis-service to humanity better? Can I call the one who does no dis-service any less of a human being to the one who does service to it? Should there be any discrimination between the two should we have to judge them?
I think we should not differentiate between scholarly achievements or humantarian ones. Each deserves its own respect. And both are essential. What is better is relative to the purpose for which it is done. As a muslim what gets me closer to Allah SWT and to a good afterlife is what I would choose and it could very well be a balance between religious achievements and humantarian achievements. Tipping the scales on either side would cause an imbalance somewhere whether felt personally or collectively in society. The delineating factor should be whether ones actions in either sphere are becoming detrimental or not.