Hello and hope you are doing well.
The pain could be due to otitis interna (inner ear infection). This could have caused lymph nodes to enlarge and hence the scalp pain. Sometimes the infection can spread into the mastoid bone behind the ear and cause pain in the scalp. You will need to consult your primary care physician for further evaluation, who may then refer you to an ENT specialist.
Hope this helped and do keep us posted.