So I heard that the precompiled contracts perform functions that are difficult to do using EVM opcodes. Does that mean the precompiled contracts are not written in EVM opcodes. Which language are precompiled contracts written in and how are they integrated into Ethereum?
Precompiled contracts aren't written in a particular language.
Usually someone proposes a new precompiled contract and suggest a possible implementation. It can be written in any language, python for example, the idea is the details and behavior are clear.
Once it is reviewed by the community and there's an agreement to adopt it. Each major client will develop its own implementation. Sometimes they'll use an external library written in assembly/C for performance reasons, others they will implement in the same language used by the client.
You can checkout the reference to go-ethereum's implementation of precompiled contracts here https://github.com/ethereum/go-ethereum/blob/master/core/vm/contracts.go