Abstract We obtained 3D nanoflowers of MoS2 (3D-MoS2) with an average size of 1–3 µm synthesized by a one-step hydrothermal method, the "flower-shape" being composed of several petal-like sheets with a thickness of about 19 nm. The 3D nanoflowers underwent functionalization with diethyl[2-hydroxy-2-(thiophen-3-yl)ethyl]phosphonate and 2-tiophene carboxylic acid. P3HT/MoS2 composites were synthesized by Grignard metathesis using a 2,5-dibromo-3-hexylthiophene/MoS2 weight ratio of 1:0.05. As a reference, the P3HT/MoS2 composites were also synthesized with unfunctionalized 3D-MoS2. The P3HT/MoS2 composites were characterized by FTIR, XRD, TEM, 1H NMR, UV–Vis, TGA, and cyclic voltammetry. We studied the influence of 3D-MoS2 nanoflowers functionalized with phosphonic and carboxyl groups on the properties of the P3HT/MoS2 composites. The addition of functionalized 3D-MoS2 in the P3HT/MoS2 composites improved the percentage of HT dyads and the definition of shoulders in the dyad signal, indicating a better arrangement of the polymeric chains in the P3HT/3D-MoS2 functionalized composites. In addition, the functionalization of the 3D-MoS2 white phosphonic group increased the conjugation length, the percentage of crystallinity, and the conductivity. Likewise, the P3HT/MoS2 functionalized composites showed a decrease in the energy gap compared to P3HT. The functionalization of the 3D-MoS2 was successfully carried out, and a close interaction between the P3HT and 3D-MoS2 was determined. We achieved the in situ synthesis of P3HT/MoS2 composites by Grignard metathesis using functionalized 3D-MoS2 obtained by the hydrothermal method. We compared two functionalization groups with 3D-MoS2 and their subsequent polymerization with P3HT. Our work provides evidence for a better performance in composites functionalized with a phosphonate group because a phosphonic anchor provides strong electronic coupling with the 3D-MoS2. The above makes this material suitable for applications in flexible electronics photosensors, electrochromic devices, photocatalysis, and harvesting energy material in solar cells. Graphical Abstract