Hello Sumit Verma,
I understand you're getting a 401 Unauthorized error when trying to call the Azure FHIR API using a service principal, even though you're able to generate the token successfully.
The error occurred as you are using wrong scope value while generating the access token.
I have one Azure Health Data Services (FHIR) service with below audience:

Now, I registered one Entra ID application and added FHIR Data Contributor role to it under FHIR service like this:

Initially, I generated access token with same scope as you and got same error like this:
Token generation:

Same error with above token while calling API:

To resolve the error, make sure to generate access token with scope set to your actual FHIR service URL like this:
https://<workspacename-fhirservicename>.fhir.azurehealthcareapis.com/.default
After I updated the scope and generated a new token using the correct value, the API call started working without any issues like this:
Token generation:
POST https://login.microsoftonline.com/tenantId/oauth2/v2.0/token
grant_type:client_credentials
client_id:<appId>
client_secret:<secret_value>
scope: https://<workspacename-fhirservicename>.fhir.azurehealthcareapis.com/.default

API call successful:
GET https://<workspacename-fhirservicename>.fhir.azurehealthcareapis.com/Patient

Let me know if you have any other questions or need help with anything else.
Hope this helps!
If this answer was helpful, please click "Accept the answer" and mark Yes for was this answer helpful, as this can help other community members.
If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.