The present invention discloses a technique of preparation of composite nanodots, and their use in the field of photoacoustic imaging, wherein, the main components of the composition are carbon nanodots, and supporting component is methylene blue, and the composition has favourable biocompatibility characteristics with the average grain size of 150-300 nanometers, and the average zeta potential of −15 to 5 millivolts. The above said techniques for preparation of composite nanodots are safe, quick and simple, low cost, and easy to perform for industrialized production. Composite carbon nanodots have good biocompatibility and safety, high photoacoustic imaging sensitivity, and it is promising in gaining wider use in the fields of biomedical imaging, targeting diagnosis and therapy, drug screening and optimization, and in vivo labelling and tracing, and has potential value in personalized medicine.