@Łukasz Engel
As I understand you are trying to get application roles as claims in access token.
you're implementing app role business logic in an app-calling-API scenario, you have two app registrations. One app registration is for the app, and a second app registration is for the API. In this case, define the app roles and assign them to the user or group in the app registration of the API. When the user authenticates with the app and requests an ID token to call the API, a roles claim is included in the ID token.
You can follow below article to achieve this,
You can create a Azure AD policy and define role claim in the policy. Once created you have to assign this policy to specific service principal associated to the application.
Let me know if you have any further questions.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.