Welcome to the forum.
You need to use a voltage divider to get the maximum voltage of the battery just below the maximum voltage of the ADC.
When you design the voltage divider you need to look at the requirements of the ADC. Have a look at the nRF52840 datasheet (see Arduino store under TECH SPECS).
The datasheet says for the slowest acquisition time the source resistance must be smaller than 800kOhm. So, this is the resistor from Vcc to the ADC pin. Now use the maximum voltage of your battery, the maximum voltage at the pin (3.3V), the resistor you picked and then calculate the second resistor.
You will need to change the analogRead library to change the setting for the ADC acquisition time because I do not think there is a function for that.
If that is not an option, you can use smaller resistor (see datasheet) but this will increase the current trough the divider or alternatively you can add a buffer capacitor parallel to the second resistor e.g. between the ADC pin and ground.
The size of the capacitor depends on the resolution you want and the sampling capacitor. e.g., 10 bits = 1024 values, you want 1/2LSB so the capacity of the external capacitor should be more than 2048 times the sampling C (2.5pF for the nRF52840 see datasheet).
Just in case you need to remind yourself: