How to input romanized Sanskrit (diacritics) in LibreOffice?

There is the alphabet called IAST for Sanskrit transliteration (to input the diacritics, special accents, etc).

How can we type the diacritics in LibreOffice?

Character input is basically a matter of operating system rather than an office suite. Thus, consult the respective manual.

Find a keyboarding solution such as https://keyman.com/ that has the characters you need. This is for any application on your system, not just LibreOffice.