After locking the level of difficulty "/ diffucility" command can be used and modified
Linked issues
Comments 3
Duplicate of MC-50607 – If you searched the tracker before creating this report, and were unable to find the indicated ticket, please comment with the keywords you searched for so that the original report can be improved.
I guess it is intended, there was at least one discussion on this already.
If you don't want to give the player the opportunity of changing the difficulty you can use NBT-Editors and disable cheats 🙂
MC-50607